Changes in C++ constructor not reflected in blueprint class

Hello all,

I am using UE 4.25.4 and I am encountering a bug where changes I make to default values in a UObject’s C++ constructor are not being propagated to the child blueprint’s default values. I have tried deleting binaries, clean build, relaunching the editor, launching from VS, and reparenting the blueprint. None of these solutions work, the only thing that seems to work is to recreate the child blueprint after the changes are made. This is not ideal as it means everytime I make any change to the BP’s default values in C++ I need to completely remake the child blueprint and copy over all of the functionality. Is there no way to force UE4 to recompile the BP with the changes to the constructor?

My guess is that it doesn’t understand that there is a change in the blueprint values.

If you’re doing a lot of tuning like that, I’d make a blueprint base for the class in question, base your other blueprints off that, and tune the base blueprint.

A blueprint class will snapshot the values that the C++ class has when it’s first created.
If you change the C++ values, you have to go into the Blueprint class, find the property/ies that changed, and press the “revert to default” little red hook-arrow next to the value.
Yes, this is tedious.

I think it makes sense that the child classes should retain their custom values even if the base class was modified.
There’s a keyword called Transient you can use in the UPROPERTY macro which will prevent the value from being serialized, might come in handy in this situation.

I don’t see any revert to default option, I am looking at the properties window in the editor. Is it located somewhere else?

image

Wouldn’t this defeat the purpose of the constructor all together? As I would have to initialize all the values at run time anyway, which is technically an option now just one I was hoping to avoid.

Thank you all for the replies.

If you still have issues, the reparent blueprint “fix” works in 5.3.x.

Reparent it to something simple like “Actor” and then back to the original cpp parent class.

Doing this will cause data loss in any properties inherited from cpp, but once the cpp parent is returned, all properties get reverted to that of the CDO (assigned from the cpp constructor).

The weird thing is that the modified properties still have the “revert to default values” arrow next to them, which when clicked, reverts them to (I guess) values set in the parent of the component class, rather than the actor containing it. Not sure if this is intended behavior but it was sure unexpected to me and caused some confusion.

TLDR: Reparent to Actor, then back to CPP parent, reconfigure lost data, and don’t touch the revert arrows!

1 Like