public void Clear() { if (mapEditor != null) { mapEditor.Clear(); } }
void MapOptionsGUI() { EditorGUILayout.BeginHorizontal(); //Clear if (!InstanceManager.hasInstances) { GUI.enabled = false; } if (GUILayout.Button("Clear", GUILayout.Width(50f))) { MapEditor.Clear(); } GUI.enabled = true; //New if (InstanceManager.hasInstances) { GUI.enabled = false; } if (GUILayout.Button("New", GUILayout.Width(50f))) { MapEditor.New(); } GUI.enabled = true; //Load if (InstanceManager.hasInstances) { GUI.enabled = false; } if (GUILayout.Button("Load", GUILayout.Width(50f))) { string path = EditorUtility.OpenFilePanel("", "", "xml"); if (path != "") { MapEditor.Load(path); } } GUI.enabled = true; //Save if (!InstanceManager.hasInstances || MapEditor.mapPath == "") { GUI.enabled = false; } if (GUILayout.Button("Save", GUILayout.Width(50f))) { MapEditor.Save(); } GUI.enabled = true; //Save As if (!InstanceManager.hasInstances) { GUI.enabled = false; } if (GUILayout.Button("Save As", GUILayout.Width(70f))) { string path = EditorUtility.SaveFilePanel("", "", "", "xml"); if (path != "") { MapEditor.SaveAs(path); } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }