Getting Enemy To Detect Collision with Player or Projectile

Hi I currently have the health system and projectile for the player set up and everything.
However I do not know how to let the game know if its colliding with the player or the projectile.Currently using the OnHit event but it only works for one object?

Thanks

Not sure what you mean with just one object, personally I did it like this:

The OnHit needs to be on the projectile, when the projectile notices it collides, it will tell whatever it collided with to call their reaction, for example with an interface call so you can implement different reactions to the impact depending on whatever was hit.

an easy way is using the capsule component of your character if it does have one, and if does not use a box or sphere collision around Character mesh.

open your character Blueprint. click on its capsule component then in details panel search for events.

there you can see on Component begin overlap and on Component end overlap

using those you can detect what starts overlapping and ends overlapping with your character so the game understands what you want it to do.

you can also check if other actor is a projectile by do casting to your projectile actor

use the capsule component of your enemy character like that and let the enemy understand if is colliding with a projectile or the player or what else.

if your enemy does not have a capsule component use a box or sphere collision component instead.