Search Unity

Problem with .BeginArea & GUILayout going to wrong place

Discussion in 'Immediate Mode GUI (IMGUI)' started by StarManta, Jun 1, 2016.

  1. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    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.
    Code (csharp):
    1.  
    2.         GUI.Box(linkRect, "");
    3.         GUILayout.BeginArea(linkRect);
    4.         GUILayout.Label("Link");
    5.  
    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?
     

    Attached Files:

  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
  3. Lorin_Atzberger

    Lorin_Atzberger

    Joined:
    Dec 11, 2013
    Posts:
    119
    Am I reading this correctly? Are they marking it as a "Will not fix"? That's a fairly strange way to treat a serious bug.