Can't refresh blueprint after C++ changes?

Hi,

Here is my issue:
Let’s take the shootergame, create a Character blueprint.
Go in C++ and add a CameraComponent attached to the capsule. Compile
Then go back in the editor and open your blueprint. You can see that the camera has been properly added.
Go back in C++ and change the Mesh1P to attach to the camera component (re-parent). Compile
Then go back in the editor and open your blueprint.

Sadly the Mesh1P is not attached to your camera. I wasn’t able to find how to refresh this other than recreating the blueprint from scratch.

More, I made some changes on CapsuleComponent via InitCapsuleSize and the change was not updated in my blueprint unless I create a new one.

Thanks,

1 Like

Hi ,

What version of the Engine are you using, and are you using a version that you built from source code, or was it installed by the Launcher?

I m on 4.3 from the launcher installation.

Hi ,

I did some testing using the binary version of 4.3.1 and was able to see something similar to what you described. I was able to reparent Mesh1P and other components that I had added to my custom character class, and those changes were reflected in the Blueprint I made from that class. However, if I tried to reparent the Mesh component, which was inherited from the parent class, that change did not appear in the Blueprint and I had to make a new Blueprint to see the change. This looks somewhat similar to another issue that was fixed a while ago. I am going to get in touch with the developer who worked on this and see if the previous fix may not be including inherited components for some reason.

1 Like

Hi ,

Sorry for the delay in getting back to you on this issue. I just did some testing on this again using our latest internal build of the Engine, and I was able to successfully reparent the mesh inherited from the parent class without having to make a new Blueprint. This issue appears to be resolved internally, and you will see it in a future version of the Engine.

1 Like

thanks for the update.

Hi. Was it fixed? I got same problem in 4.5.1.

1 Like

I have the same question as I’m seeing something similar in 4.5.1 as well. (my uproperty defaults don’t update in my blueprint and I need to create a new blueprint subclass of the C++ class each time to see the updates)

1 Like

If making a new subclass works, have you tried reparenting the BP to the same parent native code class to see if that forces a refresh of the defaults?

1 Like

It doesn’t refresh.

I have not been able to reproduce this issue in 4.5.1, using either the binary version installed by the Launcher or an Engine built from source code.

Could you provide the steps you are following when you see this happening?

Just to double check - you’re saying that UPROPERTYs that have their default value changed in native code don’t update to the new value when you recompile? I think this is by design.

I’m going to speculate as to what’s going on here - perhaps can confirm this.

By way of an example:
Your NativeActor class has a property, int32 MeaningOfLife = 42;

You create a blueprint based on the native code class. At this point, your blueprint has the same value, 42, for its variable.
When the blueprint is stored to disk, the value 42 is saved as the blueprint-defined value, effectively overriding the default. I guess you can think of this as though the blueprint-based derived class saves MeaningOfLife = 42 in its ‘constructor’ .

If you then change the native code default to 43, when you open the blueprint version the blueprint’s ‘constructor’ runs and overrides the 43, with the value that it’s been told to use (42) (really, it is deserializing the value 42 over the top of the native code default, but thinking of it in terms of a constructor might help).

The object loader has no way of differentiating a saved value of ‘42 because that is the default’ with ‘42 because the user typed 42’ and so it preserves the user value rather than assuming you wanted to just use the default.

You could implement something that checks the values on a blueprint during serialization and only saves values that are different from the defaults. However, this then leads to the opposite problem, that if you change the default, you’d then manually need to alter any blueprints where you wanted the original value.

If you want to see the updated default, you can click on the little yellow arrows to the right of the default value of the variable in the Graph tab’s Details window. This explicitly says ‘go fetch the default value from the parent class’.

1 Like

I realize that serialized values are staying as they are in blueprint.
I’m about native subobjects. I changed hierarchy by code, but in blueprint all remains as it was.

Right, so we have two different issues at play then, you have the same problem as , the original poster, but explicitly mentions the situation I’ve described instead.
For what it’s worth, I tried to reproduce your issue in a 4.5.1 github build and I couldn’t. Any you can post a minimal project that demonstrates the issue?

1 Like

I’m using binnary 4.5.1. In empty project. Character code with next content in header:

class TEST_API ATestCharacter : public ACharacter
{
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
         TSubobjectPtr<class UCameraComponent> FPCamera;
}

and next in code:

FPCamera = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FPCamera"));
//FPCamera->AttachTo(Mesh);
FPCamera->AttachTo(RootComponent);

I’m toggling attachment and compiling.

1 Like

Hi 2rusbekov,

Just to clarify, are you doing a Hot Reload in Visual Studio with the Editor still open when you change which component the FPCamera component is attached to? If so, then yes, you will not see the parent component change in the Blueprint’s Components tab. This is because the Hot Reload does not re-run the constructor for the class, so the Blueprint does not see the new attachment.

If you shut down the Editor and re-open it, does the Blueprint reflect the current attachment?

1 Like

Yes. After restarting editor it works properly.

Why Hot Reload does not re-run the constructor for the class? Will it improved?

We have a ticket in place to investigate the issue of the constructor not being re-run (UE-1201). I do not have any estimate for when this ticket will be resolved.

I solved this problem in this way : RMB on blueprints → Asset Actions → Reload.

2 Likes

Warning: Do not use this method ! This creates a duplicates and mistakes .
I spent lot of time trying to fix …