I have an object that I want players to collide with which damages them, but does not impede them. I have set it to be a trigger. The problem with setting it to a trigger is I no longer get the information about the player that has been hit, but the collider that is a child of the player object.
Player
+ RigidBody2d
- Graphic
+ Collider2d
DangerousObject
- Collider2d
(+'s are components -'s are nested game objects)
In my on OnTriggerEnter I get the collider2d which gives me the Graphic game object, but I want the player game object (the one with the rigid body and the tagging for physics). I want to know what a good solution for this is, because each thing I think of seems hacky. For instance putting a script on any object with a collider that is a child of Player that just keeps reference to player to be accessed in the OnTriggerEnter function.