- Home /
How do I copy a terrain?
My story lats over some time and I want to show the changes of teh seasons.. Therefore I need to duplicate a terrain, make some changes and then make a new copy from that one, and make further changes... The new terrains will be loaded consecutively one every "game day". However, if I first duplicate the terrain, THEN I noticed the terrain asset component, so I duplicated THAT. BUT.. when I make a change on Terrain 2, which is a copy of Terrain1 .. THE SAME CHANGE HAPPENS ON TERRAIN1
Why is this? and how can I acive what I need...? (I have ONE way, but its a pain. I made a BLANK new terrain, exported RAW DATA from the Terrain 1 and imported it into Terrain 2... but this ONLY transfers the height map, not locations of plants trees or textures...)
Mark
Answer by realprimo · Nov 24, 2018 at 12:41 PM
Duplicate your Terrain asset (IN YOUR ASSETS FILES).
Duplicate your Terrain object (IN THE HIERARCHY).
Open the Debug window into the inspector of the duplicated terrain object. --- INTO DEBUG WINDOW ---
Terrain -> Terrain data = change to your duplicated terrain asset.
Terrain Collider -> Terrain data = change to your duplicated terrain asset.
Lifesaver. Spent hours on this. Such a simple fix, thank you.
Answer by markfrancombe · Mar 16, 2016 at 05:18 PM
This question was answered CORRECTLY by @Bunny83 here: http://answers.unity3d.com/questions/25335/duplicate-terrain.html#answer-1155927
Answer by SonicScrew12 · Mar 16, 2016 at 05:41 PM
The best way to do this is to make a prefab of your Terrain 1, then instantiate it when necessary, using the instantiate command.
Let's say you name your terrain "Terrain1". In a script, declare a variable "terrain", then instantiate it using Unity's Instantiate function.
public GameObject terrain
//changeSeason is a placeholder. It's just to show when you want to change seasons
if (changeSeason) {
Instantiate (terrain, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);
}
Quaternion.identity is for default rotation (0, 0, 0), and new Vector3() is to create new coordinates for where it starts in global space.
Answer by ParadoxSolutions · Mar 16, 2016 at 12:51 AM
Changes made to copies of terrain will effect all copies created from the same terrain data, to have unique terrain assets you will need to create a whole new terrain (you can copy height maps for the same shape and allow it to be changeable if using separate terrain data)
How I would approach this is I would:
1) Sculpt terrain the way I want it. (Assuming the terrain doesn't change)
2) Decorate the terrain appropriately.
3) Copy/save the splat map (I have never done this)
4) Create a new gameobject and make all decorations children of it.
5) Select the gameobject and save it a prefab for that season, each game day have the script Instantiate the prefab (at the same position you had the gameobject when you made your decorations children of it so everything lines up with the terrain) then change the terrains splat map to whatever season you want. (the splat texture is data for the painted textures on the terrain)
Answer by Steve-Tou · Feb 19, 2020 at 02:50 AM
Hey, hope I'm not necroposting here, but I occasionally refer back to these threads when I want to copy a terrain. In case someone has the issue I was having, the copying and dragging of the terraindata works, but you have to drag the new terrain data not over the existing terrain, like you can do with a cube, sphere, etc. You have to drag it into the scene into an empty space area. This took me a while to figure out, so just thought I'd share.