Is it possible in the blueprint of an actor component to get access without casting to a variable of the actor that belongs to? For example, you have the variable of life on a character and you have a component on that character and you want to access to the life in the bp of the component.
Yes, with an Interface.
- an actor with a component, variable and implementing an interface function:
- the interface function:
- the component fetching it:
Yeah, but if I want to make another interface that deal damage to the player the problem is the same. With that solution I can get the health but if I want to set a new health on the component (the result of the damage) I need to cast to thirdperson character, right?
Use another function in the interface, or call a dispatcher - much neater.
- in the component:
- in the player:
Note that the native damage system already supports damage processing:
Half the time people reinvent the wheel, which can be fun, I admit. However, considering that we simply can…
…and have Damage Type process damage, this opens up for a plethora of options without inventing new systems. Also, consider that, perhaps, the player should not own the Health variable - you have a health component, let it manage health…
Most importantly though, how you structure it has to make sense to you and be legible.
Also, finally:
There’s the often overlooked:

I will try it. Thank you so much!








