GUIStyle.margin 外边距

var margin : RectOffset

Description描述

The margins between elements rendered in this style and any other GUI elements

外边距是指在这个样式渲染的元素和任何其他GUI元素之间的间距

This only has effect when using automatic layout (See Also: GUILayout).

这个仅影响在使用自动布局的时候。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	private RectOffset rctOff;

	void OnGUI() {

		if (GUI.skin.customStyles.Length > 0) {

			rctOff = GUI.skin.customStyles[0].margin;

			Debug.Log("Left: " + rctOff.left + " Right: " + rctOff.right);

			Debug.Log("Top: " + rctOff.top + " Bottom: " + rctOff.bottom);

		}

	}

}
// Prints the left, right, top and down values of the GUIStyle margin

//打印GUIStyle外边距的left, right, top 和 down的值



private var rctOff : RectOffset;

function OnGUI() {

	if(GUI.skin.customStyles.Length > 0) {

		rctOff = GUI.skin.customStyles[0].margin;

		Debug.Log("Left: " + rctOff.left + " Right: " + rctOff.right);

		Debug.Log("Top: " + rctOff.top + " Bottom: " + rctOff.bottom);

	}

}
Page last updated: 2011-1-20