标签:
using UnityEditor; using UnityEngine; [CustomEditor(typeof(GameObject))] public class MyEditor : Editor { void OnSceneGUI() { Handles.BeginGUI(); if (GUILayout.Button("输出位置及角度 QQ:745701540")) { GameObject[] objs = Selection.gameObjects; Vector3 v = objs[0].transform.localPosition; Vector3 v1 = objs[0].transform.localEulerAngles; Debug.Log(objs[0].name + "的位置:new Vector3(" + v.x + "f," + v.y + "f," + v.z + "f);" + "\n" + objs[0].name + "的角度:new Vector3(" + v1.x + "f," + v1.y + "f," + v1.z + "f);"); } Handles.EndGUI(); } }
放到Editor文件夹下就行啦~
标签:
原文地址:http://www.cnblogs.com/Feiyuzhu/p/5687714.html