Hello, I am working on a 2D game right now, and I am trying to instantiate a range of game objects on my board
without instantiating them randomly. Right now, I have 8 sprites for my floor tiles and 1 sprite for my outer
floor tiles. The Random.Range function works perfectly for my outerwall tiles since I only have one sprite
variation for that gameobject; however, my inner walls, or floor tiles, are instantiating randomly, and I do
not want that to happen. Is there anyway I can instantiate them without them instantiating randomly?
Here is the code I have at the moment for this particular problem:
for (int x = -1; x < columns + 1; x++)
{
//Loop along y axis, starting from -1 to place floor or outerForest tiles.
for (int y = -1; y < rows + 1; y++)
{
GameObject toInstantiate = forestTiles[Random.Range(0, forestTiles.Length)]; // I do not want these to be instantiated randomly.
if (x == -1 || x == columns || y == -1 || y == rows)
toInstantiate = outerForestTiles[Random.Range(0, outerForestTiles.Length)]; // this is working fine atm.