im making a car game were the player car collides with an enemy car and destroys it. in level 1 it’ll have 2 cars that can be destroyed. when there are no enemy cars remaining, which will load a new level.
public var explosionPrefab : GameObject;
var beep : AudioClip;
function OnCollisionEnter(col: Collision){
if (col.gameObject.tag == “Player”){
Instantiate(explosionPrefab,col.gameObject.transform);//trigger explosion
Destroy(col.gameObject);
audio.PlayOneShot(beep);
}
}
This is the error:
(6,20): BCE0023: No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(UnityEngine.Transform, System.Object)’ was found.
I dont know whats wrong because it has never happened before that i got this error, ive had a common add a “;” in this or that line. what is wrong what this script?