Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

positioning

Discussion in 'Immediate Mode GUI (IMGUI)' started by imparare, Jul 3, 2008.

  1. imparare

    imparare

    Joined:
    Jun 24, 2008
    Posts:
    369
    Hi,

    I have

    GUILayout.Label(myImage)

    how do I position this on the screen (currently defaults to 0,0). Do I have to change from GUILayout to use Rect ?

    thank you
     
  2. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    Surround it with a GUILayout.BeginArea and GUILayout.EndArea.

    Code (csharp):
    1.  
    2. GUILayout.BeginArea(new Rect(x, y, width, height));
    3. GUILayout.Label(new GUIContent(texture, "a tooltip"));
    4. GUILayout.EndArea();
    5.  
    Or add a style to it maybe and adjust coordinates on screen trough margin and padding.

    Regards,
    Marc
     
  3. imparare

    imparare

    Joined:
    Jun 24, 2008
    Posts:
    369
    Thanks Marc,

    nice to know you are looking after me on this board as well :)

    many thanks