static void OpenAIUnitEditor() { UnitAIEditorWindow.Init(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (instance == null) { Awake(); } GUI.changed = false; serializedObject.Update(); EditorGUILayout.Space(); //EditorGUILayout.HelpBox("Editing UnitAI component using Inspector is not recommended.\nPlease use the editor window instead", MessageType.Info); if (GUILayout.Button("Unit Editor Window")) { UnitAIEditorWindow.Init(); } if (TDSEditor.IsPrefab(instance.gameObject)) { if (!TDSEditor.ExistInDB(instance)) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("This prefab hasn't been added to database hence it won't be accessible by other editor.", MessageType.Warning); GUI.color = new Color(1f, 0.7f, .2f, 1f); if (GUILayout.Button("Add Prefab to Database")) { UnitAIEditorWindow.Init(); UnitAIEditorWindow.NewItem(instance); UnitAIEditorWindow.Init(); //call again to select the instance in editor window } GUI.color = Color.white; } EditorGUILayout.Space(); } EditorGUILayout.Space(); cont = new GUIContent("Unit Name:", "The unit name to be displayed in game"); PropertyFieldL(serializedObject.FindProperty("unitName"), cont); DrawFullEditor(); EditorGUILayout.Space(); DefaultInspector(); serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(instance); } }