Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Handles.ScaleHandle

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function ScaleHandle(scale: Vector3, position: Vector3, rotation: Quaternion, size: float): Vector3;
public static Vector3 ScaleHandle(Vector3 scale, Vector3 position, Quaternion rotation, float size);
public static def ScaleHandle(scale as Vector3, position as Vector3, rotation as Quaternion, size as float) as Vector3

Parameters

scale Scale to modify.
position The position of the handle.
rotation The rotation of the handle.

Returns

Vector3 The new scale vector.

Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.

Description

Make a Scene view scale handle.

This will behave like the built-in scale tool


Scale handle that will appear whenever you select the GameObject.

	// Creates a "Big" (5 times size) Scale handle that will be present whenever
	// you select the target Game Object
	
	@CustomEditor (ScaleAtPoint)
	class ScaleHandleJS extends Editor {
		function OnSceneGUI () {
	        target.sc = Handles.ScaleHandle (target.sc, 
	    					target.transform.position,
	    					target.transform.rotation,
	    					5.0);
	        Debug.Log(target.sc);
	        if (GUI.changed)
	            EditorUtility.SetDirty (target);
	    }
	}

And the script Attached to this Handle:

	// ScaleAtPoint.js
	// Usage: Place this script on the Game Object you want to use the
	// editor-created scale handle.
	
	@script ExecuteInEditMode()
	
	var sc : Vector3 = Vector3(1,1,1);
	
	function Update () {
		transform.localScale = sc;
	}