OnTriggerEnter2D() does not work !!!
Hey, I've been working on this problem fro a day... So I have trouble with 2d collision event. There is a character(with animation ) picking up objects. Objects should disappear after collision. However,it is not happening in my program!! My character has a 2d boxcollider and a circlecollider. And the PickUps have circlecolliders to. Both of character and PickUp objects have tags, but i set as different tags...not sure if i am right. I looked up many tutorials online, but it did not help me. I also checked the kinematic and trigger box. I am kinda desperate. Anyone can help me ??? :(((
HERE is part of my x # code void OnTiggerEnter2D (Collider2D other) { if (other.gameObject.CompareTag ("PickUp")) {
other.gameObject.SetActive(false);
} }
From the first image, it looks like you have some error in you PickUp script, correct those errors and try again. And, looks like the script is attached to object you're trying to pickup. Because of this, if your script works, it will disable the other collider, which in your case would be the character itself. So, remove it from the pick up objects and add to the character.