Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Sorting game object in front of canvas

A topic by Ibrahimogod created Oct 24, 2020 Views: 388 Replies: 3
Viewing posts 1 to 4

how do I sort game object in front of canvas?

notice that Render Mode set to screen space - overlay

hope you have another option instead of change render mode to camera

Moderator moved this topic to General Development
Moderator

You might want to say what engine you're using. ;)

(2 edits) (+1)

If it's Unity, and you're strictly talking about Canvas (UI components), check the Hierarchy tab. Those in the lower part of list get on top of those in the upper part.

Example:

  • Panel
    • Sprite 1
    • Sprite 2
    • Sprite 3

(Sprite 3 will appear on top of sprite 2 and 1, and Sprite 2 will appear on top of sprite 1)

Avoid Alphabetical sorting on the Hierarchy, it can get very confusing when sorting elements manually, and if it helps check the RecTransform component and use the MoveToFront and MoveToBack options.

If you are beyond that because of using multiple Canvases or some special requirements, you may try something with the Z values, but I've never needed that and I cannot assure you how that will help you reordering UI elements.



Hope this helps you a bit.

Good luck

(Edit note: I fixed a few verbs and typos. Sorry for the inconvenience. And added a video link to a tutorial)

thanks