Any good and time friendly idea to fill in a x*x space with tiles?
Edit: via script of course
Any good and time friendly idea to fill in a x*x space with tiles?
Edit: via script of course
And if maybe someone could tell me, which is faster, the for method or instantiating a prefab with the cubes already in it?
Gorbit, I use Unity 4., and unless Unity 5 has a special feature to create objects and arrange them in tiles, you will need to use two For to create an XX arrangement.
for (int r = 0; r < amountOfFiles; ++r) {
for (int c = 0; c < amountOfColumns; ++c) {
//Here your code to instantiate objects.
}
}
ocd shudder rows and columns, ranks and files… files and columns ???
Yeah, i meant a better way than that
I don’t know if there is a better way; maybe someone else can help
For me it is quite simple º_º
The other idea that i mentioned is to instantiate a prefab with all the tiles in it, but I scrapped that, beacause then I needed them to be in an array, and it’s not variable
I discarded the idea of instantiate a prefab with X amount of cubes because, as you said, if you want in a future to change the amount of objects, you will suffer a little bit :P.
A little script with a nested FORs sounds good to me, but I insist that I don’t know Unity 5 which could have some “magic” way to tile things.
Why are you looking for other alternatives? do you experience some bottle neck /overhead?
Because if there’s a way that i don’t know (and in most of the cases there is one), and it’s far more effective than what i’m using, then i’m gonna use it and spare a bunch of time, it’s just that simple