iterate through transforms

Hello,

Im using a list of gameObjects and an array of transforms to place some gameobjects and im stuck on how to iterate through the transforms to place these gameObjects.

var monsters : List.<GameObject>;//deck
var monsterPos : Transform[];
var howMany : int = 5;

for(var i=0; i < howMany; i++)
    {
        var deal : GameObject = Create();
        var pos : Transform = monsterPos[i];//iterate through the array of transforms
        deal.transform.position = pos;
}
function Create()
{
    var card : int = Random.Range(0, monsters.Count);
    var go : GameObject = GameObject.Instantiate(monsters[card]) as GameObject;
    monsters.RemoveAt(card);//remove it from the list at the int (card) position
    return go;
}

I get an error (which is on line 9)

In the past I would just do something like this for a particular transform (one) but Im stuck in this situation
deal.transform.position = pos.transform.position;How would I get this working properly? Im trying to create a gameObject at the 5 transform positions at the start.

I am really new to all of this so I may be wrong. but why not change line 9 to…

deal.transform.position = monsterPos*.position;*

Ahh Yes :slight_smile: Thank You very much!!!

(dot).position :smile: works perfectly, I think ive been at it for to long today, again thank.