Posted July 25, 2023 by SpaceDave
#tutorial
If you only need the Source Code, dive down to the end of this Guide to click on the Link, though I'd still recommend you to read the Guide.
After helping and subsequently being mentioned in a video of Overphil Dev, I decided to write this Guide on writing a powerful and simple to maintain Terrain Generation System, with a simple method of saving, it is currently in use in the Forest of Freedom Game.
THIS GUIDE IS FOR UNITY 2021.3.0f1 , I cannot guarantee it working for different versions, though it should unless drastic changes happened
This Guide will address writing a system for modifying the Unity Terrain based on Height & Alphamaps aswell as placing Gameobjects in the World, that can later be interacted by the player. The interaction system aswell as the saving system itself will not be mentioned in this guide, though they won't be too hard to get working.
First we have to think about the Systems used in this guide, some of them are poorly documented in the unity docs and so it might be quite confusing.
In this guide we will only cover a binary case of weather a layer is active or not, without talking about any amount of transitioning.
With the basics now covered, let's dive deeper into this system. We will set up a simple "island" with grass spawning above a certain height and Gameobjects getting spawned.
Thank you and have fun with your Generation System! I'd be happy to get credited, though it's not necessary!
All of the Mentioned code can be found on my Github at SpaceDave1337/TerrainGenerationSystem(link)
Click the following Link to see my newest Devlog, regarding the game this code originates from! (LINK)