- Home /
Map Generator script ?
Hi,
I'm currently thinking about creating a map generator. And I'd like to know a way to store terrain + gameobjects as one entity.
I've seen I can't add terrain to prefab. I thought about a script that would take gameobjects AND terrain to rely them "manually" but I hope there is an optimized way to work this out =D
Regards, Sladix.
PS: I found how to generate a map =D
Answer by GeekURLant · Aug 16, 2011 at 09:47 AM
The basic idea is to create some "blocks" with objects and attach to them a "block" script which contain basic informations such as if it's a border, a spawn block and so on ... And then you define a grid based on you blocks size and create a function that will look for the good blocks that can be placed, depending on position on the grid.
So the block searching function ends with an array containing ids of blocks that can be placed.
This is only my first attempt but it work well at this point. I'll surely look for an optimized solution as the blocks are still quit big and contain too much details...
Your answer
![](https://koobas.hobune.stream/wayback/20220613102710im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Anyone got a Voxel generator I can use? 0 Answers
Make a simple tree 1 Answer
How to save a prefab with script attached to it? 2 Answers
prefab instance keeps its connection to script 1 Answer
Get Height of Terrain in Script 1 Answer