Layer
Grouping Nodes
If you are curious, you can try to add the ScoreManager to the current scene and run the game, you might observe an unexpected behavior. The score text doesn't remain fixed on the screen; instead, it acts as an in-world element, staying static in a world position as the player moves around. This occurs because we haven't specified that this UI element should behave differently from another node. By default, rendering happens in world space. However, for UI elements like the score, we require screen-space rendering. This means the text's coordinates should be interpreted relative to the screen itself, not the game world.

Introducing the Layer enum is a necessary step to distinguish between standard in-world nodes and UI nodes.
Last updated