- Home /
Other
Help with instantiating a prefab
Being fairly new to Unity and only being able to learn from tutorials 'this' much, i have a question that might be a little tricky ( i think ).
So let's say i have an object X that needs to "spawn" 200 child prefabs Y. Each Y needs to have unique different values for it's variables, and the parent, X knows what value the variable each Y has.
How do i instantiate a prefab as a child, then modifying it's variables so that it doesn't change them for the other instances of that prefab?
Answer by 0V3RR1D3 · Mar 03, 2015 at 07:51 PM
Instanstiate it, Then set it as a child using Transform.parent, Then store it in an array with 200 indexes, and you can reference each on there maybe??, Oh and also use a for loop :)
What type does the array need to be to store the objects i create? Also how do i attribute to a field in that array the object i created?