Destroy Object On Collision

I’m making a 2D puzzle game and need a script that will allow the player to push a green block over an object that will unlock a gate. This is my code but it’s not working. Any help? #pragma strict function OnCollisionEnter2D(coll: Collision2D) { if (coll.gameObject.tag == "GreenBox") Destroy(Gate_Yellow); } I also tried this but it didn’t work either #pragma strict function OnCollisionEnter2D(coll: Collision2D) { if (coll.gameObject.tag == "GreenBox") coll.Gate_Yellow.SendMessage("Open", 10); } The code on the gate would be a function that destroys itself when it gets the message.

Is there any error message? The things I would check into are whether or not the “GreenBox” tag is assigned and spelled correctly. Also, I’m assuming “Gate_Yellow” is a game object, but if it isn’t (and just to make sure), you might want to change that to ‘Destroy(Gate_Yellow.gameObject)’.