This is exactly the problem interfaces solve.
Inheritance is, generally, a bad design pattern. I know that Unreal has jammed its actor system into the implementation inheritance jar, but that doesn’t make it actually good.
You can add two functions to your interface:
- GetMyValue() → Value
- SetMyValue(Value)
Once you do this, you can just pass the interface around, instead of having to pass a class instance around. Whenever you need to read the value, call GetMyValue()
. Whenever you need to write the value, call SetMyValue()
.
This is literally the problem interfaces are designed to solve, as @Everynone is saying.
Separately: if you re-parent your Character to just be an Actor, then it’s no longer a Pawn, and you can no longer make it a player character, make controllers possess it, and so on.
(This is another problem with inheritance – it would be better to make “can be possessed” be an interface, or maybe be implemented by having a component instead. But that ship sailed long ago )