I am working on a game (go figure) and am at the point where I need to start considering my load-save system. I got most of it figured out but I am discovering some things about the Unity Terrain and TerrainData that is making this more difficult.
My game has some features that include altering the terrain a lot (height changes, tree changes, layer alpha changes). When first testing these alteration in one of my scripts, I found that the terrain data stayed change after the runtime. As surprising as it was, I understood why since the terrain data is an asset.
Understanding this now there are a few ideas I have but dont know if they will work or are correct:
- When a new game is started, make a copy of the terrain data asset, put it with the player data somewhere on disk, load the asset via script and assign to terrain.
- Make a copy of the asset using the AssetDatabase and when the game is saved, copy the asset to the player data folder. On game reload, copy the file to
From my understand of the Assetdatabase, you cant copy anything into it from outside the Assets folder and should only be used for runtime asset loading, not management. And frankly I dont know what happens when builds are created in terms of bundling up these folders.
So the main question here is how are we as developers supposed to incorporate unity terrain into our save load mechanisms without altering the original assets?