Enemy not spawning correctly

Hello. Sorry for posting such a similar question to others, but it seems the answers I can find tell me there is nothing wrong with my script. I’m sure I am missing something obvious (newbie alert).

I have the following code on my Main Camera, so it should happen straight away


var zombiePrefab :Transform; //my zombie prefab is dragged onto this in Inspector
var zombieSpawnPoint = Vector3(99, 15, 36);
var zombieSpawnRotation = Vector3(0, 0, 0);

function Start(){
    var newZombie = Instantiate(zombiePrefab, zombieSpawnPoint, zombieSpawnRotation);
}

Instead of a zombie I get the following error

> BCE0023: No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(UnityEngine.GameObject, UnityEngine.Vector3, UnityEngine.Vector3)’ was found

I would really appreciate any help. I just can’t see what I have done. If I had to guess from the error message, I’d say it wants my prefab to be a GameObject not a Transform, but that isn’t right… is it?

Thanks in advance

The third parameter is a Quaternion - so you would need:

  var newZombie = Instantiate(zombiePrefab, zombieSpawnPoint, Quaternion.Euler(zombieSpawnRotation));