Question by 
               kdeshpande3 · Feb 21, 2016 at 02:46 AM · 
                scripting problemcollisionphysicscollidersboxcollider  
              
 
              Destroy object on collision not working
I am trying to destroy an object when it collides with the trigger object, but it isn't working.
I used the code:
using UnityEngine; using System.Collections;
public class Collide : MonoBehaviour
{ void OnCollisionEnter (Collision col) { if(col.gameObject.name == "trigger") { Destroy(col.gameObject); } } } }
Any help would be appreciated, thank you.
               Comment
              
 
               
              Answer by Zoogyburger · Feb 21, 2016 at 08:31 PM
You are trying to destroy the Trigger!!! Instead of
 Destroy(col.gameObject);
Use
 Destroy (gameObject);
Your answer
 
 
             