I'm trying to load TerrainData from resources dynamically and set Terrain.SetNeighbors. However, in order to use SetNeighbors I need references to a "Terrain" object, which I cannot figure out how to obtain.
I load the TerrainData in, create it as a GameObject, and render it. Nowhere in those steps do I ever deal with a Terrain object. So how do I refer to the "Terrain" of this GameObject so I can plug it into "SetNeighbors"?
TerrainData terraindata = (TerrainData)Resources.Load("Terrain/TerrainDataName"); GameObject terrain = Terrain.CreateTerrainGameObject(terraindata); terrain.transform.position = new Vector3(0,0,0); terrain.AddComponent("MeshRenderer"); terrain.renderer.enabled = true;
Help would be much appreciated.