public override void OnInspectorGUI() { base.OnInspectorGUI(); if (instance == null) { Awake(); } GUI.changed = false; Undo.RecordObject(instance, "Collectible"); EditorGUILayout.Space(); //EditorGUILayout.HelpBox("Editing Collectible component using Inspector is not recommended.\nPlease use the editor window instead", MessageType.Info); if (GUILayout.Button("Collectible Editor Window")) { CollectibleEditorWindow.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")) { CollectibleEditorWindow.Init(); CollectibleEditorWindow.NewItem(instance); CollectibleEditorWindow.Init(); //call again to select the instance in editor window } GUI.color = Color.white; } EditorGUILayout.Space(); } EditorGUILayout.Space(); DrawFullEditor(); EditorGUILayout.Space(); DefaultInspector(); serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(instance); } }
public static void Init() { // Get existing open window or if none, make a new one: window = (CollectibleEditorWindow)EditorWindow.GetWindow(typeof(CollectibleEditorWindow), false, "Collectible Editor"); window.minSize = new Vector2(400, 300); //~ window.maxSize=new Vector2(375, 800); LoadDB(); InitLabel(); window.SetupCallback(); window.OnSelectionChange(); }
public static void Init() { // Get existing open window or if none, make a new one: window = (CollectibleEditorWindow)EditorWindow.GetWindow(typeof (CollectibleEditorWindow), false, "Collectible Editor"); window.minSize=new Vector2(400, 300); //~ window.maxSize=new Vector2(375, 800); LoadDB(); InitLabel(); window.SetupCallback(); window.OnSelectionChange(); }
static void OpenCollectibleEditor() { CollectibleEditorWindow.Init(); }