Created
March 16, 2016 14:18
-
-
Save unitycoder/3babe46f5375cfee2a1b to your computer and use it in GitHub Desktop.
Modify TerrainData in editor runtime, without saving to terrain file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Q) test runtime adjustments to Terrain Data in the Unity Editor without writing to actual terrain file? | |
| A) Instantiate() the TerrainData object to get an in-memory copy, then modify that? | |
| theTerrainData = Terrain.activeTerrain.terrainData; | |
| theTerrainData = TerrainData.Instantiate(theTerrainData); | |
| Terrain.activeTerrain.terrainData = theTerrainData; | |
| Terrain.activeTerrain.Flush(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
When I came to your script, I felt close to the solution of my problem.
But it appears that it's not completely working.
What I'm trying to do is rotating a terrain in runtime, then I want the terrain to get back to its original rotation when I quit the app.
So I'm looking for the following algorithm :
The last step seems bugged: I find myself with a blend of the original terrain, and the modified copy. Everything is back except the splat map.
I was hoping for your code to solve this, but it doesn't change anything.
I heard about the fact that the TerrainCollider.terrainData must be changed as well. But that doesn't work either.
Do you have an idea about what's going on... ?
Thanks in advance !