- Home /
Doubt with GUILayout
Lets say we got this:
GUILayout.BeginArea (Rect (10,10,100,100));
GUI.DrawTexture(Rect(10,10,50,50),image);
GUI.DrawTexture(Rect(110,110,50,50)image2);
GUILayout.EndArea ();
image2 will not be displayed because is out of the Layout, but is the DrawTexture call made? Do I have to check with an if() if the texture is in the limits of the Layout or Unity does is for me an do not Call DrawTexture if is not shown?
GUILayout
and GUI
don't have any influence on each other. But other than that, Unity doesn't do GUI culling. TBO It's a pretty crap system, can't wait till 4.2
You could easily perform a test on your own: Have this code run in an otherwise empty scene, and see if you get two or one draw call. You're also missing a comma from the 2nd DrawTexture call.
In the game window, upper right hand corner is a button called "Stats". That shows draw calls, frame rate (supposedly) and other useful info.
Why don't you just position it so it's in the layout?
Pretty sure it is drawn regardless of whether you can see it or not.
I've always used:
GUI.BeginGroup
not sure how different that is from:
GUILayout.BeginArea