Instantiate a grid of boxes?

Hey guys, first post so be nice :stuck_out_tongue:

I’ve been working on some stuff in unity over the past week and have been moving along pretty well but have hit a stump.

Basically I want to Instantiate a series of boxes (in the form of a grid, each are prefabs) but i want to be able to reference each of them individually. My initial thought was multi-dimensional array of prefabs but i can’t seem find out how to do it.

Any thoughts or can you think of a better way to go about it?

Hi and welcome ! :slight_smile:

Instantiate() returns an object that you could save into an array. Is that what you mean ?


oxl

Well that was how I wanted to do it. But I can only find out how to make single dimensional arrays. What I wanted to do was reference each box depending on it’s position in the grid. Eg. box_array[0][0] would be row 0 col 0. box_array[0][1] would be row 0 col 1. Etc .