Getting editor values into C++ class

Hi there, I have a very simple C++ class which I wish to be able to tweak one of the properties in (is that the right C++ term?) in the Editor. If I change the value in the editor, however, it does not change within the class.

Here is the relevant code from my test class:

.h
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
		int32 TotalDamage = 5;
.cpp
AMyActor::AMyActor()
{
	UE_LOG(LogTemp, Warning, TEXT("Total damage in constructor %d"), TotalDamage);
}
void AMyActor::PostInitProperties()
{
	Super::PostInitProperties();
	UE_LOG(LogTemp, Warning, TEXT("Post init %d"), TotalDamage);
}

If I change the Total Damage in the Editor to 10 I’d expect to see something like:
Total damage in constructor 5 (not sure the variables have been updated by the editor value at this stage - could be wrong though!)
Post init 10

But I dont. I see:
Total damage in constructor 5
Post init 5

I’m sure I’m being dense somewhere - have I just not understood how this works?

Many thanks (and apologies if this appears as a repost, I’m having one of those days :frowning: )

Hello 3arlOfSandwich,

For this log statement you’re trying to use to follow this value, it would be better if you used this function instead.

OnConstruction(const FTransform& Transform)

Using that it would output correctly for me. It is also called every time a value is changed.

Hope this helps!

Thanks , it also changes in BeginPlay as well (makes sense!) I’d spent so long going in circles I’d missed the obvious. This isn’t boding well for my adventures in UE4 :wink: