Cant get pick up packaage message to print

helpo 2

I have followed the instructions completely but the trigger message (Package picked up) doesn’t seem to work no matter what I do. Any help please?

I have set the square as trigger as well.

This script has to be on the car. It appears you have placed it on the package

It stilll doesnt seem to be working please.



Everything looks fine and when I test it with your settings (the ones I can see) it works fine for me. Can you expand the Rigidbody2D on the car, please?

Okay, no problem. Thank you for the help.
rigid

Earlier before i had got this message below when i clicked play but i changed the folder the project was saved in and it stopped appearing.


picof setop

this looks fine, too. can you upload the project somewhere so I can take a look? I’m not sure if your folder change caused the issues but nothing I can see here is a problem

Where would be best to send/upload?

Anywhere we both can access. Google drive, for example

Sorry, I almost forgot about this. I don’t have access to the folder. I need permission

Yeah, got it. The problem is simple; You have a space in front of your tag. Your tag is " Package" but then you check if you hit “Package” - which is not the same. I had to make a new tag without the space, and then set the tag on Package and Square to the new one. Then I could delete the one with the space. You could, of course, leave it like it is and just check if (other.tag == " Package") but I do not recomend that.
This issue is why we recommend you use other.CompareTag("Package") instead of other.tag == "Package". CompareTag will not only compare the tag, but also check if it exists and raise an exception if it doesn’t. That’s how I found the issue. It’s too easy to make a typo and anything that helps to eliminate error is a good thing

Thank you so much for the help, It worked! I will use other.CompareTag from now on and be more careful XD.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms