Why can't i collect item in unity 2d?
I've in my game project items which i can collect: apples, hearts and keys( by them i have possibility to open exit). I only have problem with these keys. In the beginning everything was working, but when i turn off computer (i've saved script and whole project) and open unity again i could notice that i can't collect keys (apples and hearts still were working). I tried to repair - i've checked whole script, tags, colliders, but everything was alright... 1 hour ago i deleted everything in script what was linked with keys, and rewrite once again, i was pretty sure that would help but unfortunetly nothing happend. Here is the part of my script:
Answer by phocker · Apr 13, 2017 at 05:01 PM
I would suspect the culprit is your if-then-else logic. Instead try using a switch statement on the tag. Also verify which tag is being hit. Lastly, if there are any overlapped objects with colliders you need to use the method to view all colliders that are hit.