Hi, I’ve placed a component on my ‘player’ character class. This class inherits from a 'base player ’ character class which does not have the component. I’m curious what people would do to access this component inside the ‘base player class’. Is BPI the best option?
Your ‘base player class’ probably shouldn’t have any logic that deals with the component.
If the inventory is relevant to the base class, it should probably be the one own it.
If the component is in the right place, then the logic you’re trying to put in the base class is probably going in the wrong place.
I’m probably missing something here, but the base class just can’t see the component, can it?..
You could create a helper function that returns the component, then override it in the child with the component connected.
UFUNCTION(BlueprintImplementableEvent)
UMySceneComponent* GetMyComponent();
Thanks everyone! @ClockworkOcean, yeah base class can’t see it as it only exists on children. But, yes @MagForceSeven, I think you make a valid point and actually re-structuring is in order.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.