Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question How to make sure a button is always on top

Discussion in 'UGUI & TextMesh Pro' started by TiggyFairy, Mar 27, 2023.

  1. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    517
    Hello, I have some button icons with images that I move from menu to menu on my UI with tweening. The snag is that they often pass behind parts of my menu. I've tried several solutions from searching:
    • Messing with the hierarchy. This isn't feasible for what I want to do because the icon is already jumping about in the hierarchy as part of my move system.
    • Putting the icons in sorting groups using the Sorting Group Component. This doesn't seem to have any effect, no matter what order I put them in.
    • Making the icons sprites, then using the inbuilt sprite sorting groups. This just makes them invisible or sends them to the back. Trying to fix this seems to involve making everything a sprite, which would likely wreck my UI.
    • Adding a Canvas set to "Screen Space - Overlay" to the button. This stops them from being interactable.
    Can anyone help me with any of these?
     
  2. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    517
    Anyone?