- Home /
TerrainData available in scene view
Hi,
I'm currently learning Unity and I am confused by one thing:
When I change some GameObject in runtime in the Start() method and I stop the game and go back to the scene view, the GameObject is "back" where it was at design time. But when I set data to a terrain in the Start() method via TerrainData.SetHeights(), this terrain data is still available in scene view after stopping the game. Do I have a misunderstanding?
Thanks in advance!
Answer by Bunny83 · Jul 30, 2018 at 04:16 PM
Anything that is located in a "scene" will be reverted when playmode is stopped to the state before you entered playmode. However any changes to assets in the project will persist. So changing the settings a a Material asset, texture import settings and also changes to ScriptableObjects which are stored as asset in the project. The TerrainData is just a ScriptableObject asset store in your project. The Terrain object is located in the scene. That's why changes to the TerrainData will persist while changes to the Terrain (like replacing the TerrainData reference) will not persist.
Thank you very much for this explanation!
Could you by chance point out anywhere in the documentation where this is covered more in detail what happens between scene mode and play mode?
Thanks again!
Well, most things related to the serialization system is mentioned here. Though this difference isn't explicitly mentioned here. There are some official blog posts like this one which might help a bit.
Your answer
Follow this Question
Related Questions
Weird shader behavior , when displacing vertices. 1 Answer
Background won't appear in Gameview, but will in Sceneview? 0 Answers
Game View: no objects from the script, one created in the scene is just black stain 0 Answers
HDRP Decal Projector doesn't show in game view 0 Answers
Cannot see scene/game in editor after loading a project 1 Answer