HELP! Variable being redefined unexpectedly!

Hey guys! I’m at a complete loss to why something is happening. In the C++ header for a character, I define the following under the protected: section.



UPROPERTY(BlueprintReadOnly, Category = PositioningSystem)
float PelvisMaxHeight = 90.15; //Used to limit the maximum height of the pelvic bone above the ground

When I try to printout the value of PelvisMaxHeight at begin play through blueprint, the value displayed is 200.0. At first I thought I was redeclaring it somewhere else in the code… in the header, or in the implementation… but after searching through both the C++ code as well as the BP code, there are no other references to PelvisMaxHeight anywhere, besides a Get node to display the value in blueprint. Does anyone have any idea why this could be getting redefined? Has anyone else encountered this?

I’m currently switching over to ue 4.26 so hopefully the problem just goes away. I’ll eventually need to redefine the variable at runtime, so I can’t make it const right off the bat.

If the value has already been serialized into a Blueprint, then changing it in C++ will no longer have any effect. You should mark the variable as “EditDefaultsOnly”, then check the value displayed in the Blueprint.

NB: Also, you’ll get slower compile times if you keep changing the header to alter a default value. It’s usually best for workflow to initialize values in the constructor.

Ahh, thats a good suggestion. I’ll switch it around to the constructor next.

What do you mean by having the value “serialized” into a blueprint though, and how do I avoid it? I’ve been recompiling every time I change the value, so I assumed that would update the blueprint, no?

Also, if this helps, when I do a search in Rider, this is what comes up:
PelvisMaxHeight.jpg

No idea why that shows up. There’s no reference to it in the blueprint.

Do you possess a pawn placed in the world when you start the game? I found that instances of actors already placed in the world often retain their old values after changing them in C++ or Blueprint, even when they are marked with EditDefaultsOnly. Deleting the old actor and replacing it with a new instance (not a copy of the old) is the only fix.

I do infact to that. Ill try your suggestion.