Observed Behavior
In lecture 70 when using OnTriggerEnter2D, OnCollisionEnter2D with print, there is no message on neither collision nor on when there would be Trigger.
Expected Behavior
Obviously, there’s supposed to be SOME message in console. (either “Collision” or “Trigger”)
What I’ve tried:
I’ve been through the code many times, there’s not a lot to mess up on.
Watched the lecture three times to see if I missed something
Have you added this script as a component to the LoseCollider game object?
Is your script filename the same as the class, I notice that you have called the class LoseColider, the same with your variable of colision in the OnCollisionEnter2D() method, e.g. missing the second letter L in both cases. Scripts and classes are required to the same name.
Hey thanks for quick reply! Unfortunately, everything and I mean EVERYTHING crashed on me so I had to rebuild the scene (here’s a lesson about not saving). While on that I made a new object and script this time making sure to keep things you mentioned in mind but, sadly, the issue is still the same
For whatever reason all my objects have “Z” value showing in Unity (unlike in course video). Think it’s related?
For whatever reason all my objects have “Z” value showing in Unity (unlike in course video). Think it’s related?
Quite possibly yes, if you consider the objects in that 2D game to be like pages of a book, some are behind others, some are in front of others… you’d want the objects you are testing for collisions on to be the same as the collider…
ah, ok, sorry, I was going by the screenshots… if you can zip up the project and make it available for me to download I will happily take a look for you.