UnityEngine.Object.Instantiate

Hi,

I’m keep having this problem trough I have read about it :

No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(System.Type, UnityEngine.Vector3, UnityEngine.Quaternion)’ was found.

#pragma strict

var explosion = GameObject; 

function OnCollisionEnter (collision : Collision) {
	
	if (collision.gameObject.tag == "Player") {
	var contact : ContactPoint = collision.contacts[0];
	var rotation : Quaternion = Quaternion.FromToRotation(Vector3.up, contact.normal);
	var instantiatedExplosion : GameObject = Instantiate (explosion, contact.point, rotation);
		Destroy(gameObject);
		
		}
}



function Start () {

}

function Update () {

}

Thaks for further help :slight_smile:

This line is wrong:

var explosion = GameObject; 

It creates a variable of type System.Type and assigns the type GameObject to it.

The correct line is:

var explosion: GameObject; 

and you must drag the explosion prefab to this field in the Inspector, or a Null Reference error will occur.