Home > front end >  Unity GameObject rendering below GameObject lower in the hierarchy
Unity GameObject rendering below GameObject lower in the hierarchy

Time:04-22

I have a GameObject (TopSquare) that is rendered after PlayButton in the hierarchy, yet the PlayButton is showing on top. This goes against Unity's rule of objects added last are shown over objects added previously.

enter image description here

enter image description here

Why is this?

CodePudding user response:

The square is a sprite that is an object in the World, while the button exists in the UI layer over it.

You have to use UI Image for black square instead of sprite renderer (Right-click on parent -> UI -> Image)

  • Related