void OnGUI() { GUILayout.Label("Hello World!"); }
void OnGUI() { if (GUILayout.Button("Click me!")) { Debug.Log("Button clicked!"); } }
string textFieldValue = "Enter text here"; void OnGUI() { textFieldValue = GUILayout.TextField(textFieldValue, 25); }These examples demonstrate how to create various UI elements using GUILayout in Unity. The library used here is the Unity Editor UI system, which is a part of the Unity engine itself.