drag and drop collision 2D of the object that will collide
hi everyone. complete noob here. basically my game is very simple. i have a set of "icons" that i need to move to a specific object. these icons work in a drag and drop following the tutorial found here: drag and drop tutorial
so let's say the object that i'm dragging is called "r_dust" and it should collide with "bigbag". i've tried the code below attaching the script to r_dust:
void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.name == "bigbag")
Destroy (coll.gameObject);
}
but nothing happens, r_dust goes through bigbag. any suggestions? from what i understand i need to identify the item that it should collide with which is "bigbag" then have itself destroyed. like am i missing something with the layers? both items are boxcollider2d and rigidbody2d
please help.
thanks.
i think i got it. i used ontriggerenter2d ins$$anonymous$$d.
Your answer

Follow this Question
Related Questions
2Dcollision problem 0 Answers
Collision layer matrix in 2D - Where did it go ? 1 Answer
Triggers Colliding With Triggers Not Working? [Solved] 1 Answer
Player Character Not being destroyed. unity 5.3 2 Answers
How to grip a character with a rope ? 0 Answers