Korant
(Korant)
1
Hi everyone,
I have a class StatsController, where I’m storing my character’s _health:
class UStatsController : public UActorComponent
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = HUD)
int32 _health;
};
In my HUD EventGraph, I’m doing the following:
Event Contstruct ->
Get Player Character -> Cast To MyACharacter
In my HUD HealthProgressBar, I’m able to see the Stats Controller, but there are no available Sub-Object Properties to bind to.
How can I enable my _health (or even a float _percentHealth) to be a bind point in the HUD blueprint?
DanaFo
(DanaFo)
2
You need to make the member variable visible and editable in blueprints, here are the parameters explained:
most commonly though:
(inside your component .h)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = whateveryouwant)
membervariabletype membervariablename;
in the object constructor, initialize it:
APlayerPawn:APlayerPawn()
{
membervariablename = blah;
}
Then in the HUD, drag off the cast of the AMyCharacter and search for the member variable name.