0
votes

I have a game object with a UI Canvas in it and several child UI objects inside that and want to make this game object/canvas to stay top-most above all other possible UI layers.

The purpose for this is a FPS/Counter/Stats UI that can be dropped into any game and therefore this UI should stay top-most. However when testing with some Unity3D projects (UFPS for instance) I noticed that it's own UI puts itself in front of the UI of my FPS counter.

Can somebody give me a hint how I can achieve my FPS Counter to stay topmost?

1

1 Answers

0
votes

Elements on a canvas are rendered by order in the hierarchy, from top to bottom. Simply rearrange the items in the hierarchy to get the desired effect.

There are also a couple of new methods available to let you set the position in the hierarchy via code. You have the following available

Transform.SetAsFirstSibling

Transform.SetAsLastSibling

Transform.SetSiblingIndex