Insert a space in the current layout group.
function OnGUI () { GUILayout.Button ("I'm the first button"); // Insert 20 pixels of space between the 2 buttons. GUILayout.Space (20); GUILayout.Button ("I'm a bit further down"); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnGUI() { GUILayout.Button("I'm the first button"); GUILayout.Space(20); GUILayout.Button("I'm a bit further down"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnGUI() as void: GUILayout.Button('I\'m the first button') GUILayout.Space(20) GUILayout.Button('I\'m a bit further down')
pixels
are measured horizontally:function OnGUI () { GUILayout.BeginHorizontal(); GUILayout.Button ("I'm the first button"); // Insert 20 pixels of space between the 2 buttons. GUILayout.Space (20); GUILayout.Button ("I'm the second button"); GUILayout.EndHorizontal(); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnGUI() { GUILayout.BeginHorizontal(); GUILayout.Button("I'm the first button"); GUILayout.Space(20); GUILayout.Button("I'm the second button"); GUILayout.EndHorizontal(); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnGUI() as void: GUILayout.BeginHorizontal() GUILayout.Button('I\'m the first button') GUILayout.Space(20) GUILayout.Button('I\'m the second button') GUILayout.EndHorizontal()