Page 1 of 1
Sort Order not respected with UI Toolkit
Posted: Thu Apr 25, 2024 6:45 am
by KoryCode
I run into an issue where the dialogs are always appearing on top.
Even if I set the sort order of my pause menu to extreme high numbers into the thousands.
The dialog system still appearing on top with a sort order of 100.
I would like to show my pause menu on top the dialog.
my pause menu using UI Toolkit not canvas, but that should not mater
![Screenshot 2024-04-25 113609 sm.png](./download/file.php?id=4856)
- Screenshot 2024-04-25 113609 sm.png (185.02 KiB) Viewed 216 times
Could you help me please?
Re: Sort Order not respected with UI Toolkit
Posted: Thu Apr 25, 2024 9:59 am
by Tony Li
Hi,
There's nothing specific to the Dialogue System. Is the Canvas that contains your dialogue UI a Screen Space - Overlay canvas? Its default sort order should be 0, not 100, although you're free to change it.
Are you using Unity 2021.2 or higher? Sort order compatibility between the two UI systems was added in 2021.2.
Re: Sort Order not respected with UI Toolkit
Posted: Thu Apr 25, 2024 6:12 pm
by KoryCode
I'm on 2022.3.16
I have changed the sort order of the Dialog Manager canvas to 10 now the pause Menu (sort order 50) is over it. which is correct.
But the animal selector which is also UI Toolkit with sort order 0 appears over it now.
I'm using Screen Space - Overlay for the dialog.
It is weird. I guess it is not a dialogue system but a Unity issue.
Maybe I just move the dialog system out of screen while the Pause menu is open.
Or maybe it is possible to hide it without loosing it state (as it is paused)
![Screenshot 2024-04-25 225627.png](./download/file.php?id=4857)
- Screenshot 2024-04-25 225627.png (922.25 KiB) Viewed 205 times
Re: Sort Order not respected with UI Toolkit
Posted: Thu Apr 25, 2024 7:23 pm
by Tony Li
Hi,
The easiest way to reliably hide it without losing its state is to disable its Canvas. Example:
Code: Select all
DialogueManager.displaySettings.defaultCanvas.enabled = false;
Then enable it again when you close the pause menu.
Re: Sort Order not respected with UI Toolkit
Posted: Thu Apr 25, 2024 7:28 pm
by KoryCode
Thank You Tony! That actually works very well and looks better than if I overlay it! Awesome!
Re: Sort Order not respected with UI Toolkit
Posted: Thu Apr 25, 2024 8:31 pm
by Tony Li
Glad to help!