I have made an empty with a script attached into a prefab named Gameover. I then made a variable so that I could connect it to a script in the inspector. But when I try to instantiate it it throws this error:
Assets/Mouth.js(21,21): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(System.Type, UnityEngine.Vector3, UnityEngine.Quaternion)' was found.
This is the script trying to instantiate it:
var Gamover :GameObject;
var pickedup :GameObject;
function Update () {
}
function OnTriggerEnter(other:Collider){
if (other.name=="Bodypart"){
var bodyparts=(GameObject.FindGameObjectsWithTag("Bodypart"));
for (var bodyparttodestroy : GameObject in bodyparts){
Destroy(bodyparttodestroy);
}
var turnpoints=(GameObject.FindGameObjectsWithTag("TP"));
for (var turnpointtodestroy : GameObject in turnpoints){
Destroy(turnpointtodestroy);
}
Instantiate (Gameover);
// Game Over or Lives deducted
}
if (other.name=="Pickup"){
}
Debug.Log(other.name);
Instantiate(pickedup,other.transform.position,other.transform.rotation);
Destroy(other.gameObject);
if (other.name!="Terrain"){
}
}