private void CreateGolfTerrian(float xSize, float zSize, int w, int h, Vector3 gridStart, AreaType Type) { GameObject obj = new GameObject("Terrian_" + Type.ToString()); obj.transform.parent = GameObject.Find("GolfMap").transform; obj.layer = 16; MeshFilter mf = obj.AddComponent <MeshFilter>(); MeshRenderer mr = obj.AddComponent <MeshRenderer>(); if (Type == AreaType.Fairway) { mr.sharedMaterial = AssetDatabase.LoadAssetAtPath <Material>("Assets/Art/Model/Sketchups/Materials/GolfTerrain1.mat"); } else if (Type == AreaType.Rough) { mr.sharedMaterial = AssetDatabase.LoadAssetAtPath <Material>("Assets/Art/Model/Sketchups/Materials/GolfTerrain2.mat"); } else if (Type == AreaType.SandBunker) { mr.sharedMaterial = AssetDatabase.LoadAssetAtPath <Material>("Assets/Art/Model/Sketchups/Materials/GolfTerrain3.mat"); } else if (Type == AreaType.PuttingGreen) { mr.sharedMaterial = AssetDatabase.LoadAssetAtPath <Material>("Assets/Art/Model/Sketchups/Materials/GolfTerrain4.mat"); } GolfMeshCreate _creator = new GolfMeshCreate(); Mesh mesh = _creator.CreateMesh(w, h, xSize, zSize, gridStart, Type); mf.mesh = mesh; SaveMesh("Assets/Mesh/", Type, mesh); SubMapData sm = new SubMapData(Type, _creator.Listpt, _creator.ListTriangle); m_map.AddSubMap(sm); }