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

パラメーター

scale 変更するスケール値
position ハンドルの位置
rotation ハンドルの回転
size スクリーン上でハンドルのサイズをスケーリングするサイズ

戻り値

Vector3 ユーザーのハンドル操作によって更新された値。ユーザーがハンドルを操作しない場合は、関数に渡した値と同じ値が返されます。

説明

シーンビューの Scale ハンドルを作成します。

注意: 画面サイズに対して固定サイズのハンドルを持ちたい場合、 HandleUtility.GetHandleSize を使用します。

This will behave like the built-in scale tool


Scale handle that will appear whenever you select the GameObject.

// 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 the script Attached to this GameObject:

// Name this script "ScaleAtPoint"
using UnityEngine;
[ExecuteInEditMode]
public class ScaleAtPoint : MonoBehaviour
{
    public Vector3 scale = Vector3.one;
    public void Update()
    {
        transform.localScale = scale;
    }
}