public static void OnHubGUI() { if (m_level == null || m_layout == null) { m_level = GameObject.FindObjectOfType <Level>(); return; } Editing = EditorGUILayout.Toggle("Editing", Editing); GUI.enabled = m_layout.Dirty; if (GUILayout.Button("Save")) { string path = EditorUtility.SaveFilePanelInProject("Save Level", "newlevel", "xml", "Save levels in \"Resources/Levels\"!"); m_layout.Serialise(path); } GUI.enabled = true; if (GUILayout.Button("Load")) { string path = EditorUtility.OpenFilePanel("Open Level", Application.dataPath + "/Resources/Levels", "xml"); if (!string.IsNullOrEmpty(path)) { m_layout = LevelLayout.Deserialise(path); Level.Instance.LoadFromLayout(m_layout); } } }
public void Start() { s_instance = this; m_raycastHit = new LevelGridRaycastHit(); m_meshRenderer = GetComponent <MeshRenderer>(); LevelLayout layout = LevelLayout.Deserialise(@"C:\Unity\Squad\Assets\Resources\Levels\newlevel.xml"); LoadFromLayout(layout); }