void OnGUI () { GUILayout.Box ("Hello World!"); }
Texture2D texture = Resources.LoadBoth examples use the GUILayout.Box() method to create a rectangular area in the user interface. In the first example, a simple label is placed inside the box. In the second example, a button and a texture are added inside the box using the GUILayout.BeginHorizontal() and GUILayout.EndHorizontal() methods to horizontally group the controls inside the box. The GUILayout Box component and the other IMGUI controls are part of the UnityEngine package library.("my_texture"); void OnGUI () { GUILayout.Box ("My Box", GUILayout.Width(200), GUILayout.Height(100)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Click Me")) { Debug.Log("Button Clicked!"); } GUILayout.Label(texture); GUILayout.EndHorizontal(); }