1

My problem is that I don't know why I can't have one UI element in front of an object and the others UI elements behind it... I don't know how to correctly explain my problem so I will explain it using some screenshots:

n1 I would like to have the "new text" text ahead the "healthEnemy" object, if I simply edit the z axis it seems to work:

n2

The problem is that now, every UI elements are ahead my object:

n4

Is there a way to put just one UI element ahead a game object?

My canvas settings:

canvas

Jr Antonio
  • 193
  • 1
  • 4
  • 20

1 Answers1

3

If you are fully using Canvases to make those elements you can simply create 3 canvases :

  • One for the elements behind, one for middle elements and one for front elements.
  • Then you can adjust "Order in Layer" parameter in the canvas component to adjust their orders (e.g. Background Canvas will be at 0 , Middle one at 5 , Front one at 10)
  • Then you can simply add UI elements depending the order you want it to be in Layer.

Happy coding!

(P.S: don't forget to uncheck "Graphic Raycaster" component in the Canvas if you are not willing to interact with the canvas (e.g. clicking) )

GhAyoub
  • 525
  • 4
  • 11