static function Space (pixels : float) : void
Description描述
Insert a space in the current layout group.
在当前层组插入空白。
The direction of the space is dependent on the layout group you're currently in when issuing the command. If in a vertical group, the space will be vertical: Note: This will override the GUILayout.ExpandWidth and GUILayout.ExpandHeight
空白的方向取决于你当前层组。如果是在垂直组,空白将是垂直的。注意:这将重写GUILayout.ExpandWidth 和 GUILayout.ExpandHeight
Space of 20px between two buttons.
两个按钮之间的20像素空距。
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");
}
}
function OnGUI () {
GUILayout.Button ("I'm the first button");
// Insert 20 pixels of space between the 2 buttons.
//在2个按钮直接插入20像素的空白
GUILayout.Space (20);
GUILayout.Button ("I'm a bit further down");
}
In horizontal groups, the pixels are measured horizontally:
在水平组,像素是相对于水平方向:
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 the second button");
}
}
function OnGUI () {
GUILayout.Button ("I'm the first button");
// Insert 20 pixels of space between the 2 buttons.
//在2个按钮直接插入20像素的空白
GUILayout.Space (20);
GUILayout.Button ("I'm the second button");
}