-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditorLoader.cs
49 lines (40 loc) · 1.21 KB
/
EditorLoader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using UnityEditor;
using UnityEngine;
using System.IO;
using UnityEditor.SceneManagement;
namespace VoxelTerrain
{
public class EditorLoader : EditorWindow
{
// Add menu item named "Voxel" to the Window menu
[MenuItem("Window/Voxel/VoxelEditorLoader")]
public static void ShowWindow()
{
//Show existing window instance. If one doesn't exist, make one.
EditorWindow.GetWindow(typeof(EditorLoader));
//EditorWindow.GetWindow(typeof(EditorLoader)).minSize=new Vector2(300,200);
}
void OnGUI()
{
string[] levelList = SaveLoad.getSavedMaps();
//GUILayout.Label("Click Prepare Terrain Before Loading Terrain");
//if(GUILayout.Button("Prepare Terrain")){
// DestroyImmediate(GameObject.Find("VTerrain").GetComponent<VoxTerrain>());
// GameObject.Find("VTerrain").AddComponent<VoxTerrain>();
//}
GUILayout.Label("select Level to load", EditorStyles.boldLabel);
foreach (string levelName in levelList)
{
if (GUILayout.Button(levelName))
{
VoxTerrain.LoadFromFile(Path.GetFileName(levelName));
}
}
}
public void Update()
{
// Update Voxel Terrain in Editor
//Repaint(); VoxTerrain.Instance.Update();
}
}
}