using UnityEngine;
using System.Collections;
public class Sprite_Colection : MonoBehaviour {
public void start(){
Update ();
}
public void Update(){
Run ();
}
public void Run(){
Collision2D col = new Collision2D();
OnTriggerEnter (col);
}
public void OnTriggerEnter(Collision2D col){
Debug.Log (col.gameObject.name);
Destroy (col.gameObject);
if (col.gameObject.name == "item1(clone)") {
Debug.Log ("detected collision item1");
Destroy (col.gameObject);
} else if (col.gameObject.name == "item2") {
Debug.Log ("detected collision item2");
Destroy (col.gameObject);
} else if (col.gameObject.name == "item3") {
Debug.Log ("detected collision item3");
Destroy (col.gameObject);
} else if (col.gameObject.name == "item4") {
Debug.Log ("detected collision item4");
Destroy (col.gameObject);
} else {
Debug.Log("detected collision but no name match");
}
}
}
this is the code that i am using to detect collisions and when i run the project is is giving me this error:
I need help on whet is causing it please