Version: 5.5
public static Vector3 ScaleHandle (Vector3 scale, Vector3 position, Quaternion rotation, float size);

Parámetros

scale Scale to modify.
position The position of the handle.
rotation The rotation of the handle.
size Allows you to scale the size of the handle on-scren.

Valor de retorno

Vector3 The new value modified by the user's interaction with the handle. If the user has not moved the handle, it will return the same value as you passed into the function.

Descripción

Make a Scene view scale handle.

This behaves like the built-in Scale tool.


Scale handle that will appear whenever you select the GameObject.

Note: Use HandleUtility.GetHandleSize if you want the handle to always remain the same size on the screen.

// Name this script "ScaleAtPointEditor"
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(ScaleAtPoint))] [CanEditMultipleObjects] public class ScaleAtPointEditor : Editor { public void OnSceneGUI() { ScaleAtPoint t = (target as ScaleAtPoint);

EditorGUI.BeginChangeCheck(); Vector3 scale = Handles.ScaleHandle(t.scale, Vector3.zero, Quaternion.identity, 1); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Scaled ScaleAt Point"); t.scale = scale; t.Update(); } } }

And attach this script to the GameObject:

// Name this script "ScaleAtPoint"
using UnityEngine;

[ExecuteInEditMode] public class ScaleAtPoint : MonoBehaviour { public Vector3 scale = Vector3.one; public void Update() { transform.localScale = scale; } }