Handles.Label 标签

static function Label (position : Vector3, text : string) : void
static function Label (position : Vector3, image : Texture) : void
static function Label (position : Vector3, content : GUIContent) : void
static function Label (position : Vector3, text : string, style : GUIStyle) : void
static function Label (position : Vector3, content : GUIContent, style : GUIStyle) : void

Parameters参数

Description描述

Make a text label positioned in 3D space.

在3D空间制作一个文本标签。

Labels have no user interaction, do not catch mouse clicks and are always rendered in normal style.

标签没有用户交互,不捕捉鼠标点击并总是以标准风格渲染。

Label in the Scene View.
在场景视图的标签。

// Create a 180 degrees wire arc with a ScaleValueHandle attached to the disc
// that lets you modify the "shieldArea" var in the WireArcExample.js, also
// lets you visualize some info of the transform
//创建一个180度弧线带有ScaleValueHandle附加到圆
//让你可以在WireArcExample.js修改shieldArea变量
//并可以让你直观的看到一些变换的信息
@CustomEditor (DummyLabelScript)
class LabelHandle extends Editor {
	function OnSceneGUI () {
		Handles.color = Color.blue;
		Handles.Label(target.transform.position + Vector3.up*2,
		target.transform.position.ToString() + "\nShieldArea: " +
		target.shieldArea.ToString());
		Handles.BeginGUI(Rect(Screen.width - 100, Screen.height - 80, 90,50));

		Handles.DrawWireArc(target.transform.position,
		target.transform.up,
		-target.transform.right,
		180,
		target.shieldArea);
		target.shieldArea =
		Handles.ScaleValueHandle(target.shieldArea,
			target.transform.position + target.transform.forward*target.shieldArea,
			target.transform.rotation,
			1,
			Handles.ConeCap,
			1);
	}
}

And the script attached to this Handle:

该脚本附加到这个控制柄物体:

// DummyLavelScript.js

var shieldArea : float = 5;
Page last updated: 2011-7-9