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);
	}
}
最后修改:2011年1月20日 Thursday 17:55

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。