1. First, you need to download Object2Terrain.cs and put in inside Unity Editor folder.
2. Then import any mesh to Unity which you want to convert, and put it inside the Hierarchy (Scene).
3. With that mesh selected in the Hierarchy (Scene), at the top toolbar select Terrain > Object To Terrain.
4. You will see some settings pop up. Leave them at default and press Create Terrain.
If you want to have a higher poly terrain, or just want to paint more detail on the terrain, increase the Resolution value (it will increase the tris count of the terrain). Or lower it if you want to decrease the detail.
5. DONE! Here you can see that a new Terrain was created. It’s overlapping my original mesh, this way I can see how accurate my Unity Terrain looks.
Let’s hide original mesh and leave the Terrain to see it better.
You can edit the terrain if you want. Select Terrain and do whatever you want by using Unity Terrain Editor (create hills, paint texture, grass, trees, etc.).
My Unity prefab is gone - FIX
If you create the Terrain Prefab, it won’t work after you close Unity and run it again! That’s because Unity Terrain should have Terrain Data file, which is NOT created using Object2Terrain converter:
Originally when you create Unity Terrain, Terrain Data file is created too:
You can find it inside Assets folder
To fix this, you need to
1. Select the Terrain which was created using the converter. Go to Terrain Settings.
Scroll down and press Export Raw… (to export Height Map).
Depending or your device, select Windows or Mac and export using default settings.
2. Hide the Terrain, so it won’t distract us.
3. Create a new Terrain (inside Hierarchy press on Create > 3D Object > Terrain). With our new Terrain (1) selected, go to Terrain Settings. Scroll down, you will see Resolution tab.
We need to copy:
- Terrain Width
- Terrain Lenght
- Terrain Height
- Heightmap Resolution
from our hidden Terrain and paste these exact settings here inside our newly created Terrain (1).
Now Terrain (1) settings should look like this (it depends on your converted Terrain settings):
4. With Terrain (1) selected, inside Terrain Settings press on Import Raw… (to import Height Map we exported before).
Select that Height Map and import it. Depending on your device, select Windows or Mac and import using default settings.
THAT’S IT! Now we have Terrain (1) which looks like converted Terrain.
It has Terrain Data!
That means if I drag and drop Terrain (1) to the Project tab, it will create a prefab. And now I can save it, quit Unity, launch it again, and I will have fully working Terrian (1) prefab.
Thank you for stopping by! :)
If you want to support me, you can do that by subscribing to my YouTube channel or by buying my Game Assets. This helps me to create more content for you guys! Appreciate any support :)