插入灵活的空白元素。
灵活的空白元素将占用布局中的任何剩余空间。
注意:这将覆盖 GUILayout.ExpandWidth 和 GUILayout.ExpandHeight
Flexible Space in a GUILayout Area.
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public float sliderValue = 1.0F;
void OnGUI() {
GUILayout.BeginArea(new Rect(0, 0, 200, 60));
GUILayout.BeginHorizontal();
GUILayout.RepeatButton("A button with\ntwo lines");
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
GUILayout.Box("Value:" + Mathf.Round(sliderValue));
sliderValue = GUILayout.HorizontalSlider(sliderValue, 0.0F, 10);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
}