- Home /
Question by
KVinS · Aug 27, 2013 at 10:53 PM ·
assetresources.load
How I can download Terrain from .Asset file?
Terrain prefab = (Terrain) Resources.LoadAssetAtPath("Assets/NewTerrain.asset", typeof(Terrain));
Terrain c = Instantiate(prefab, new Vector3(-53, 0, 0), new Quaternion(0, 0, 0,0)) as Terrain;
Doesn't work
Comment
.asset.asset looks suspicious. Are you should it shouldn't be .asset?
Best Answer
Answer by KVinS · Aug 27, 2013 at 11:37 PM
TerrainData terrainData = new TerrainData (); terrainData = AssetDatabase.LoadAssetAtPath ("Assets/New Terrain.asset", typeof(TerrainData)) as TerrainData; GameObject terrainGameObject = Terrain.CreateTerrainGameObject(terrainData);
Work
Answer by hellaeon · Aug 27, 2013 at 11:01 PM
Hi KVins,
Can I enquire : what you are trying to accomplish by manually loading and setting it as a prefab?
Do not post comments or inquires as answer. Use comment function to do so