Value Not Being Set In Constructor

I have a two floats ‘StartingHitPoints’ and ‘HitPoints’, in the constructor of my actor class I set HitPoints = StartingHitPoints.

StartingHitPoints Is exposed with EditAnywhere and Hitpoints VisibleAnywhere.

I have a BP class which inherits from my CPP class so I can add Arty stuff like particles, but when i change StartingHitPoints it does not chnage HitPoints.

What is the issue, or is this just an underlying Unreal thing I have to work around?

Many Thanks Folks…

Make A new function in your .h file call it whatever like

void SetHitPoints();

add this to your .h file

//Begin UObject Interface
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif // WITH_EDITOR
//End UObject Interface

In your cpp file add in

void yourcalsssname::SetHitPoints()
    HitPoints = StartingHitPoints;

Also in the in your cpp file add

void AOutOfBoundsVolume::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)

When you edit the1st number, second will take 1st numbers setting.


Worked a treat thanks

np, glad it works for you.