Instantiating prefab at child (spawnlocations are arrays)


I want to instantiate an object at one of my children.

So I’ve listed all my children in an array like this one: var array : Transform [] = new Transform[blabla];

Than I’ve put my children in the array like this: array *= transform.Find("All of my Children");*
Don’t mind the details on how I did this, it worked, and I’ve tested the children like this: array[0].Translate(Vector3.right);
The child was moving so it’s in the array for sure;)
But now I want to instantiate a prefab at the position my children has (they are actually spawnpoints).
If I use this: Instantiate(prefab, array[0], Quaternion.identity);
it gives me an error:
> Assets/Scripts/Game/SpawnLeft.js(30,20):
> BCE0023: No appropriate version of
> ‘UnityEngine.Object.Instantiate’ for
> the argument list
> '(UnityEngine.Transform,
> UnityEngine.Transform,
> UnityEngine.Quaternion)’ was found.
So why is this not an appropriate version? The array is of type Transform… so what’s wrong?

you want to instantiate a gameobject, and your second entry is not a position but a transform.

Instantiate(gameObject, position, rotation) you are doing Instantiate(transform,transform,rotation);

Thanks for the quick reply!

array[0].position works! =D

And I’ll pay more attention the next time!