Check if blueprint implements a specific actor component

I’m working on improving my implementation of health in my game, and from the looks of it creating a reusable Actor Component blueprint seems like the way to go. The idea is that I could drop this on any blueprint that I wanted to manage health on, be it a character, a car or a building.

This is in and of itself not a problem. However, the problem comes from figuring out whether a target blueprint implements a Health Component.

I.e., I have a player with a weapon, an enemy (which has a Health Component) and a physics object (which does NOT have a Health Component) in a scene. When a projectile the player shoots hits any of these two other objects, the projectile will check if they contain a Health Component. If they do, run an event from the Health Component on the object. If they don’t, apply force to the object instead.

Could anyone shed some light on how to test for this via blueprint (if at all possible)?

1 Like

Interfaces. I use Interfaces for this kind of functionality.

I have Interface with function “get Gameplay Stats Component” which i call to each object which i want to affect, if return is not valid, that means object doesn’t have component implemented.

Gameplay Stats Component itself has interface with function for each data what im interesting in.