I am trying to make a classic top-down rpg. I want to make it so that when the player character faces an NPC and presses A, a dialog box pops up.
How do I get the player character to interact with a character in front of him? Physics2D.raycast isn’t working for me.
You could use a box collider set to a trigger just in front of your character and when you press the desired key, check if anyone is in that trigger and that’s the guy you interact with.