unity3d

Immediate Mode Graphical User Interface System (IMGUI)

Syntax#

  • public static void GUILayout.Label(string text, params GUILayoutOption[] options)
  • public static bool GUILayout.Button(string text, params GUILayoutOption[] options)
  • public static string GUILayout.TextArea(string text, params GUILayoutOption[] options)

GUILayout

Old UI system tool, now used for fast and simple prototyping or debugging in game.

void OnGUI ()
{
    GUILayout.Label ("I'm a simple label text displayed in game.");

    if ( GUILayout.Button("CLICK ME") )
    {
        GUILayout.TextArea ("This is a \n
                             multiline comment.")
    }
}

GUILayout function works inside the OnGUI function.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow