I want to display a large score-counter in the middle of my scene. However, I notice that my GameObjects are moving underneath the Score-counter. At this time, I want to reverse that, but I didn’t found any “Sorting-Layer” option in the UI Elements.
I would be grateful for some help!
I dont understand exatly what you mean… its a 2d game? Must the score panel move with the camera? And you want it under the game gameobjects? Then you can make a new canvas and set ta high number for the distance from the camera.
you can choose if you’re using sprite renderer what object is in front.
- counter: Order in Layer: -1
- rest: Order in Layer : 0
if you want to change order in layer of the counter:
getComponent<SpriteRenderer>().sortingOrder = 1 //if in front
getComponent<SpriteRenderer>().sortingOrder = -1 //if in back.
I’ll assume you are using the current UI System, and not the legacy IMGUI system.
Create a canvas.
A. Make the Canvas a World Space Canvas.
Then just place it behind your sprites, in front of your playfield.
B. Or alternatively, set your Canvas to “Screen space - Camera”.
Then push the Plane distance behind your sprites. This might be easier.