public static TransformRotationGUIWrapper GetTransformRotatGUI(Transform tran) { if (transformRotationGUIType == null) { if (unityEditorAssembly == null) { unityEditorAssembly = System.Reflection.Assembly.GetAssembly(typeof(UnityEditor.Editor)); } if (unityEditorAssembly != null) { transformRotationGUIType = unityEditorAssembly.GetType("UnityEditor.TransformRotationGUI"); } } TransformRotationGUIWrapper wrapper = null; if (transformRotationGUIType != null) { System.Object guiObj = Activator.CreateInstance(transformRotationGUIType); if (guiObj != null) { wrapper = new TransformRotationGUIWrapper(); wrapper.t = tran; wrapper.guiObj = guiObj; CallInternalFunction(transformRotationGUIType, "OnEnable", false, false, true, guiObj, new object[] { new SerializedObject(tran).FindProperty("m_LocalRotation"), EditorGUIUtility.TrTextContent("Rotation", "The local rotation.") }); wrapper.mi = transformRotationGUIType.GetMethod("RotationField", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { }, null); } } return(wrapper); }
private void PrepareTransformGui(Light light, ref TransformRotationGUIWrapper wrapper) { if (light != null && (wrapper == null || wrapper.t != light.transform)) { wrapper = EditorCommon.GetTransformRotatGUI(light.transform); } }