OnGUI drawing order?

How to I arrange what order things are drawn when multiple classes are calling OnGUI?

I thought I could manage this by simply arranging the script execution order in the project settings, and the scripts called later would be drawn after the others. But that doesn’t seem to do it; I adjusted that execution order but I still have the OnGUI for one script getting called before the OnGUI in another script.

Rule #1 of Unity: your logic is not their logic.
So in this case you control the beast by having one central class with one OnGUI that calls all the OnGUIDraw() of each of your other classes.

You can use GUI.depth.

1 Like