I’ve seen many other threads similar to this subject, but i’m not sure if it’s the same thing.
I have a blueprint actor with a component on it. The blueprint sets a value to a variable of the component.
The actor is on the map. I didn’t change a thing in the instance of the actor or it’s component. Using only the default values.
But, when I restart the editor and select the actor in the map, the component’s variable has the wrong value. Instead of using the value setted by the actor blueprint, it is using the default value of the component’s implementation.
(It only happens when the component inherits from a C++ base class).
(Update: in another personal project, the issue also happens with a pure C++ component… in this example project, however, the issue only affects the blueprint component which inhnerits from the C++ component…)
The Github link I gave contains an example. Three blueprints with one float variable each. One blueprint (the one that inherits from C++) has the error.
Okay, at first I thought it was because bWantsBeginPlay = true re-runs the constructor, but I don’t think so. It probably runs the begin play function.
What if you removed the MyCppFloat = 0.f from the constructor and instead set the float directly in the header?
I’ve downloaded your project, but following your repro steps does not seem to reproduce the issue on my end. I’m seeing the value of the float in MyComponentInheritedFromCppCode as 1, which is expected because you are setting it to 1 inside of the MyActor blueprint.
Is this not what you are seeing on your end? Could you provide a screenshot of what you’re seeing?
Okay, let me know the results of the update. Even after restarting the editor, I’m still seeing 1 as the value for the float variable. I’m not sure what is different on your end that is causing you to see 0. Did you make any other changes other than the steps you provided?
Well, 4.12.3 fixed the issue. Arey you using this version? I think it’s related to this release note: “Fixed! UE-31743 Components derived from scene component reset vector location upon closing and re-opening editor”. Thank you anyway!