Hi everyone we try to destroy an object on collision with another object. Here is what we tried

void OnTriggerEnter2D(Collider2D col){

We added 2D RigidBody to our main object and the other has a polygon collider. How can we destroy the object? Thank you.


  1. firstly you have to destroy the gameObject of the col like this:


  2. Create a new instance of the object

var newObject : GameObject = Instantiate(/your settings/);

  1. (!)If you have a script for the camera to follow your main object - don’t forget to attach it to the newObject

    var followScript = Camera.main.GetComponent(Name of the script); = newObject.transform;

Hope it will help you :wink: