Question by
madferretdd · Nov 12, 2021 at 12:00 PM ·
c#loopsnestedgroups
Nested For Loop Question
Hi All,
I'm building a City Generator currently using nested for loops to create a Grid.
for (int x = 0; x < gridX; x++)
{
for (int z = 0; z < gridZ; z++)
{
Build City
}
}
I would like to group areas of the grid to make Regions like below in the example below where gridX = 5 and gridZ = 5 and Regions = 5.
Is this possible? and how?
Thanks,
grid2.jpg
(86.6 kB)
Comment
Answer by unity_hosein · Nov 13, 2021 at 04:12 AM
i think if you are using this you always get one things. you must use Random.range to get random number