How save terrain height and splat to file use c# ?

Hello everybody!

I am making a level editor for the game. I was able to implement height change and texture painting at runtime.

Now the question is how to save the created terrain to a file?

The terrain itself has Import / Export Raw heightmap buttons. How can I implement this method via c #?

Maybe there are other ways? Thanks for answers.

If your only goal is to make a level editor wouldn’t it make more sense to export the entire terrain and re-import that? Or is there something specific you’re need with the height map and texture?

Of course that would be cool, but how can you export a entire terrain?

Look up serialization for Unity

https://medium.com/@madisonkarrh/serialize-entire-gameobjects-in-unity-803a1c942cfa

1 Like

Oh, thank you.

Do you have a 2D array of all the terrain’s heights? You can save that array to a file and reload it. Though the serialization approach might do some of this automatically, not sure.

I solved the problem using serialization, which was given in the link above.

1 Like