I’m having a weird problem with BeginArea. I have an editor UI with a number of windows (Areas) that can be opened/closed and moved around. I’m using BeginArea extensively to use GUILayout within these windows.
In the screenshot, you can see the problem near the lower left: the overlapping text label and “Add condition” button should be in the box to the right, not in the parent box they’re in.
Here is the code that draws the box and starts the GUILayout area.
GUI.Box(linkRect, "");
GUILayout.BeginArea(linkRect);
GUILayout.Label("Link");
The GUI.Box is being drawn in the correct place, but the layout code started with GUILayout.BeginArea is going to the wrong area. (the “Link” text is the text that’s overlapping the other text in the screenshot) I’m having trouble understanding how these two function calls, being called with the same rect literally right next to each other in the code, can be going to two different places. I have confirmed through Debug.Logs that linkRect remains unchanged before and after these lines.
It should be noted that the layout contents seem to be locked to the parent window - when I drag around the view or the parent window, those contents stay with it. It seems like when it comes time to paint these controls, they are simply being drawn to the wrong “Area”, like they’re getting mis-linked within UnityGUI’s internal code. (When I open link windows on other windows, each one is consistently rendered on top of its own parent window.)
Has anyone experienced a bug like this before? Am I missing something about the way BeginArea works that makes it different from .Box?