Unity之Handles旋转控制器-十三

Unity编辑器类在Scene下绘制旋转控制柄
Unity之Handles旋转控制器-十三
文章图片







using UnityEngine; using System.Collections; using UnityEditor; [CustomEditor(typeof(Arraw))] public class HandlerTest : Editor {float rectangleSize = 3; void OnSceneGUI() { float width = HandleUtility.GetHandleSize(Vector3.zero) * 0.5f; Arraw arraw = (Arraw)target; Handles.color = Color.red; //返回旋转角度 arraw.rot = Handles.RotationHandle( arraw.rot, Vector3.zero); if (GUI.changed) { EditorUtility.SetDirty(arraw); }} }Arraw脚本如下,将其拖拽到需要绘制的对象上即可 using UnityEngine; using System.Collections; public class Arraw : MonoBehaviour {public Quaternion rot = Quaternion.identity; }

































【Unity之Handles旋转控制器-十三】

    推荐阅读