public override void OnInspectorGUI() { if (GUILayout.Button("Open Editor")) { MoveEditorWindow editor = MoveEditorUtils.ShowMoveEditorWindow(); editor.SetMove(_move, null, true); } if (GUILayout.Button("Build Move")) { MoveEditorUtils.BuildMove(_move); } if (GUILayout.Button("Select In Project")) { EditorGUIUtility.PingObject(_move.gameObject); Selection.activeGameObject = _move.gameObject; } DrawDefaultInspector(); for (int i = 0; i < _move._hitEvents.Count; ++i) { EditorGUILayout.ObjectField(_move._hitEvents[i]._particleProperties._particleReference.Value, typeof(ParticleSystem), false); EditorGUILayout.ObjectField(_move._hitEvents[i]._particleProperties._flippedParticleReference.Value, typeof(ParticleSystem), false); } for (int i = 0; i < _move._particleEvents.Count; ++i) { EditorGUILayout.ObjectField(_move._particleEvents[i]._particleProperties._particleReference.Value, typeof(ParticleSystem), false); EditorGUILayout.ObjectField(_move._particleEvents[i]._particleProperties._flippedParticleReference.Value, typeof(ParticleSystem), false); } //EditorUtility.SetDirty(_move); }
void CreateNewMove() { GameObject go = new GameObject(_name); Move move = go.AddComponent <Move>(); move._animationClip = _clip; if (MoveEditorUtils.IsClipShared(move)) { EditorUtility.DisplayDialog("ERROR", "Another move is already using this animation clip! Only one move may be assigned to an animation clip", "OK"); return; } if (System.IO.File.Exists(MoveEditorUtils.GetMoveFilePath(_name))) { if (!EditorUtility.DisplayDialog("Overwriting Prefab", "A prefab with this name already exists. Are you sure you want to overwrite it?", "Yes", "No")) { DestroyImmediate(go); return; } } if (!System.IO.Directory.Exists(MoveEditorUtils.GetMovesDirectoryPath())) { System.IO.Directory.CreateDirectory(MoveEditorUtils.GetMovesDirectoryPath()); } string prefabPath = _isCommon ? MoveEditorUtils.GetCommonMovePrefabPath(_name) : MoveEditorUtils.GetMovePrefabPath(_name); GameObject prefab = PrefabUtility.CreatePrefab(prefabPath, go); DestroyImmediate(go); if (prefab != null) { EditorGUIUtility.PingObject(prefab); if (EditorUtility.DisplayDialog("Success!", "New move created successfully! Open it in the Move Editor now?", "Yes", "No")) { MoveEditorWindow editor = MoveEditorUtils.ShowMoveEditorWindow(); editor.SetMove(prefab.GetComponent <Move>(), null, true); } } }