text | Optional text to display in the area. |
image | Optional texture to display in the area. |
content | Optional text, image and tooltip top display for this area. |
style | The style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background. |
Begin a GUILayout block of GUI controls in a fixed screen area.
function OnGUI () { // Starts an area to draw elements GUILayout.BeginArea (Rect (10,10,100,100)); GUILayout.Button ("Click me"); GUILayout.Button ("Or me"); GUILayout.EndArea (); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, 100, 100)); GUILayout.Button("Click me"); GUILayout.Button("Or me"); GUILayout.EndArea(); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnGUI() as void: GUILayout.BeginArea(Rect(10, 10, 100, 100)) GUILayout.Button('Click me') GUILayout.Button('Or me') GUILayout.EndArea()