GUIStyle.border 边框

var border : RectOffset

Description描述

The borders of all background images.

所有背景图片的边框。

This corresponds to the border settings for GUITextures. It only affects the rendering of the background image and has no effect on positioning.

这个对应于GUITexture的边框设置,它只影响背景图片的渲染并不影响定位效果。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	private RectOffset bdr;
	void OnGUI() {
		if (GUI.skin.customStyles.Length > 0) {
			bdr = GUI.skin.customStyles[0].border;
			Debug.Log("Left: " + bdr.left + " Right: " + bdr.right);
			Debug.Log("Top: " + bdr.top + " Bottom: " + bdr.bottom);
		}
	}
}
// Prints the left, right, top and down values of the GUIStyle border
//打印left, right, top 和 down 边框的值

private var bdr : RectOffset;
function OnGUI() {
	if(GUI.skin.customStyles.Length > 0) {
		bdr = GUI.skin.customStyles[0].border;
		Debug.Log("Left: " + bdr.left + " Right: " + bdr.right);
		Debug.Log("Top: " + bdr.top + " Bottom: " + bdr.bottom);
	}
}
Page last updated: 2011-1-20