💾 Archived View for www.modulink.io › unity › 2022-11-28.gmi captured on 2023-01-29 at 02:33:40. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Lots of fun new learnings today. I needed to see if the player was touching an object in the scene. My first inclination was to use OnCollisionEnter2D but it turns out this is best used for objects that will actually collide. I want my player to walk over the top of an object and not bump againt them. To do this we add a Collider2D to the object but then select "IsTrigger". This allows you to move through the collider but still see if a collision is detected. We do this by using "OnTriggerEnter2D". Once I get the object I can check names, tags, etc. to see what the player is touching. That seems to be it!