void Init(Simple2DAnimatorController animatorController) { controller = animatorController; if (controller.animatorData.animatoins != null && controller.animatorData.animatoins.Length > 0) { animList = new string[controller.animatorData.animatoins.Length]; for (int i = 0; i < controller.animatorData.animatoins.Length; i++) { animList[i] = controller.animatorData.animatoins[i].nameID; if (controller.animatorData.animatoins[i].step <= 0) { controller.animatorData.animatoins[i].step = step; } } } else { controller.animatorData.animatoins = new Simple2DAnimatorDataList[] { }; animList = new string[] { }; } animIX = 0; index = 0; animIXLast = -1; }
public static void OpenWindow(Simple2DAnimatorController animatorController) { Simple2DAnimatorControllerEditor editor = GetWindow <Simple2DAnimatorControllerEditor>(); GUIContent titleContent = new GUIContent("• 2D Animator Controller Editor"); editor.minSize = new Vector2(800, 600); editor.titleContent = titleContent; editor.Init(animatorController); }
public override void OnInspectorGUI() { Simple2DAnimatorController t = (Simple2DAnimatorController)target; EditorGUILayout.Separator(); GUI.backgroundColor = Color.magenta; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Открыть в редакторе", Style())) { Simple2DAnimatorControllerEditor.OpenWindow(t); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.Separator(); GUI.backgroundColor = Color.white; DrawDefaultInspector(); }