Handles
- ArrowCap
- BeginGUI
- Button
- CircleCap
- ClearCamera
- color
- ConeCap
- CubeCap
- currentCamera
- CylinderCap
- Disc
- DotCap
- DrawAAPolyLine
- DrawBezier
- DrawCamera
- DrawCapFunction
- DrawLine
- DrawPolyLine
- DrawSolidArc
- DrawSolidDisc
- DrawSolidRectangleWithOutline
- DrawWireArc
- DrawWireDisc
- EndGUI
- FreeMoveHandle
- FreeRotateHandle
- Label
- lighting
- matrix
- PositionHandle
- RadiusHandle
- RectangleCap
- RotationHandle
- ScaleHandle
- ScaleSlider
- ScaleValueHandle
- SetCamera
- Slider2D
- Slider
- SnapValue
- SphereCap
Handles.ScaleValueHandle 缩放值控制柄
static function ScaleValueHandle (value : float, position : Vector3, rotation : Quaternion, size : float, capFunc : DrawCapFunction, snap : float) : float
Parameters参数
- valueThe value the user can modify. // 用户可以修改的值
- positionThe position of the handle. // 控制柄的位置
-
rotationthe rotation of the handle. // 控制柄的旋转
-
sizeThe size of the handle.
控制柄的大小 - snapThe new value after the user has modified it. Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.
用户修改后的新值。注意:使用HandleUtility.GetHandleSize你可能希望有恒定屏幕大小的控制柄
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.
这个用来制作缩放控制柄的中心。用户可以点击并拖拽来缩放一个单一浮点数上下。
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);
}
最后修改:2011年7月8日 Friday 12:17