instantiating objects problem

Simply, on spawn I’m generating a grid of empty game objects to use as random spawn locations, these are then stored in an array, then chosen at random to spawn enemies on.

However, this line " Instantiate(obj, pos, Quaternion.identity); " is giving me an error of: “Assets/Scripts/levelOneScript.js(58,18): BCE0023: No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(UnityEngine.GameObject, UnityEngine.GameObject, UnityEngine.Quaternion)’ was found.” I’ve messed about changing from Transform to GameObject, etc but it’s never liked.

Any ideas would be very welcome.

function newSpawn() { 

   for (i=0; i<amountEnemies; i++) 
      var obj : GameObject = enemyPrefabs[Random.Range(0, enemyPrefabs.length)]; 
      var pos : Transform = spawnPoints[Random.Range(1, spawnPoints.length)]; 
      Instantiate(obj, pos, Quaternion.identity); 

In the newSpawn function, pos is a gameobject. Change the instantiate to:

Instantiate(obj, pos.transform.position, Quaternion.identity);

or declare the pos variable correctly:

var pos = (spawnPoints[Random.Range(1, spawnPoints.length)]).transform.position;