The console is not printing out the text I have created


Not sure why the text wont appear any help would be appreciated thank you.

Here are some things that could help:

-Make sure that you have a tag named “Package” on your package Game Object
-Check for any typos on your tag
-Check your colliders
-Make sure you don’t have anything in front or behind the car. Hence, the car having a bigger/smaller Z axis will cause no collision

Hope this helps!

Yeah I triple checked the spelling , the tag and colliders and yet when I take off the IF statement it works fine but going back and adding it again after making sure things are right it still doesn’t print .

If it works without the if but it doesn’t work with the if then the package’s tag is not correct. Perhaps change if (other.tag == "Package") to if (other.CompareTag("Package")) it’s a safer option because it does some validation for you.

Sounds good!


got this now after trying that.

Yeah, that’s what I thought. This is why using CompareTag("Whatever") is better than tag == "Whatever". Go to Edit -> Project Settings. In the project settings window, find Tags and Layers on the left and select it.

You will see a lists of, well, tags and layers. Expand the ‘tags’ list and check the ‘Package’ tag. Make sure it doesn’t have any spaces in front or behind.

Yeah it’s spelled just fine no spaces , see that’s weird I have been using unity for a few months a never heard of compareTag lol.

That doesn’t make sense. Unity is saying there is no “Package” tag when clearly there is one. Just for my own sanity, could you put this above the if

Debug.Log($"[{other.tag}] {other.tag.Length}");

and share the result?

Also make sure that your code is attached to your Game object (player)

Yeah it it attached this is why I hate programing and rather just do level design but gsmedev tv only has one course for that lol and I need to have a better impressive portfolio.

Maybe you can share your project, and I can take a look at it?

I did the pics I posted are where the issues are.

I know but I’m saying to create a folder of your game and post it here. That I believe creates a copy for me to view and playtest

Or, if you want to not do that, just send a ss of the driver game object

It is attached. The CompareTag() won’t execute (and fail) if it wasn’t attached to some game object, and the code won’t 'work without the if’ if it wasn’t attached to the player.

Perhaps Unity is just being Unity and a restart will resolve the issue. I can see that the tag exists, yet Unity seems to believe it doesn’t. Restarting it may reload the tags list into whatever mechanism it uses when reading them, and then the problem is solved.

Yeah that had to be it, and considering there’s only like 10 lines of code, there’s not really much to check for.

Privacy & Terms