- Home /
Drawing a GUI.DrawTexture call above GUI.Button in seperate scripts
I have a script which controls my main menu functionality which in OnGUI() draws multiple GUI.Buttons. Clicking each button begins a separate loading screen script which in OnGUI() calls GUI.DrawTexture and draws a black texture rectangle which covers the entire screen. I need this black texture to be on top of the buttons which are being drawn from a different script.
I have tried altering the depths of both separate OnGUI() calls before realising that the depth is dependant on the separate OnGUI() calls. I have also tried to adjust the script execution order and placing the loading screen script so it executes later.
Is there an alternative way to control the depth of GUI components between different scripts?
So this does not work you say? : http://docs.unity3d.com/Documentation/ScriptReference/GUI-depth.html
It doesn't answer your question but one workaround would be to simply stop drawing the buttons while the loading screen is active.
Yes, unfortunately, GUI.depth does not appear to be working between two seperate OnGUI calls. As a temporary solution, I did something similar, where by I faded the GUI buttons out as the black texture faded in.