Handles.ScaleValueHandle 缩放值控制柄

static function ScaleValueHandle (value : float, position : Vector3, rotation : Quaternion, size : float, capFunc : DrawCapFunction, snap : float) : float

Parameters参数

Description描述

Make a single-float draggable handle.

制作一个单一浮点数可拖动控制柄。

This is used to make the center scale handle. The user can click and drag to scale a single float up and down.

这个用来制作缩放控制柄的中心。用户可以点击并拖拽来缩放一个单一浮点数上下。

Handles.ScaleValueHandle 缩放值控制柄

Scale Value handle in the scene view with an arrow cap as the handle.
在视图中的缩放值控制柄,带有箭头体作为控制柄。

// Increase/decrease a value just by moving an Arrow Handle
//增加减少一个值,仅通过移动箭头控制柄
@CustomEditor (ScaleValueModifier)
class ScaleValue extends Editor {
	function OnSceneGUI () {
		target.floatVal =
		Handles.ScaleValueHandle(target.floatVal,
		target.transform.position,
		Quaternion.identity,
		30,
		Handles.ArrowCap,
		1);
		if (GUI.changed)
			EditorUtility.SetDirty (target);
	}
}

And the script attached to this Handle:

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

// ScaleValueModifier.js
// Usage: Place this script on the Game Object
// you want to modify "floatVal" by dragging the Arrow Handle
//放这个脚本到你想通过拖动箭头控制柄修改floatVal的游戏物体上
@script ExecuteInEditMode()

var floatVal : float = 1;

function Update() {
	Debug.Log("Value Modified: " + floatVal);
}
Page last updated: 2011-7-8