using UnityEditor;
using UnityEngine;
using CreateTerrainDLL;
public class CreateTerrainMenu : EditorWindow{
[MenuItem("CreateTerrainMenuItem/CreatTerrain")]
public static void OpenTerrainCreatWindow()
{
EditorWindow.GetWindow(typeof(CreateTerrainMenu));
}
Class1 class1 = new Class1();
CreateTerrainDLL.Security se;
void OnEnable()
{
se = new CreateTerrainDLL.Security();
Debug.Log(se.HardWareCode);
class1.GetMeshEvent += Class1_GetMeshEvent;
}
private void Class1_GetMeshEvent(UnityEngine.Mesh mesh)
{
if (mesh == null)
Debug.Log("mesh is null");
else
Debug.Log("mesh created");
GameObject go = GameObject.Find("DEMTerrain");
if (go != null)
DestroyImmediate(go);
go = new GameObject("DEMTerrain");
go.AddComponent<MeshFilter>();
go.AddComponent<MeshRenderer>();
MeshFilter meshFilter = (MeshFilter)GameObject.Find("DEMTerrain").GetComponent(typeof(MeshFilter));
meshFilter.sharedMesh = mesh;
}
void OnGUI()
{
class1.start();
class1.onGUI();
}
}