4.18.3 Still a problem…
Guys, this is a major problem, come on! It’s still occurring in 4.19.
I encountered this issue with some floats that were being set in editor and used for computations in construction script. It seems like an easy workaround, at least in my case, is just to force a recompile by moving actor in level. It will only rebuild once, and has correct value.
Engine version 4.19.1 in my case.
4.20.2, still happening.
I’ve submitted a pull request with a fix for this issue: https://github.com/EpicGames/UnrealEngine/pull/5239
It applies instance data before construction script runs, so component properties have their instance values while blueprint runs.
@Matt.Enright, I hope your fix works and gets into engine soon! I just encountered this bug again in my current project, 3 years after discovering this bug first time…
4.22.0 - still an issue.
It’s almost 4 years now ! That’s kinda Epic !
4.25 and counting
Well, 6 years later and version 4.26 and it’s still not fixed. GG go next
Still an issue in 5.0.0. issue is marked as Won’t Fix but there’s no reason why: Unreal Engine Issues and Bug Tracker (UE-21838)
Why is this issue marked as resolved when it is still broken. And why is ticked marked as Won’t Fix for no apparent reasons? It’s been 6 years… This is not very professional for a commercial engine.
Bump. This is still a thing. “Won’t fix” is not a solution.
5.2 -_-
So i guess this way Epic wants to say us, do not init any component properties cpp/bp in construction script easy way . But it has something to do with FPrimitiveComponentInstanceData , i.e Static mesh component uses it by derriving it to FStaticMeshComponentInstanceData to cache data between construction scripts.
/** Called before we throw away components during RerunConstructionScripts, to cache any data we wish to persist across that operation */ | |
---|---|
virtual TStructOnScope GetComponentInstanceData() const; |
I see there few options:
- So we implement that and cache custom properties
- Do a begin play component sync init for custom components.
- Maybe data can be init on PostCompInit as well, in call order it goes after UserConstructionScript.
Still bugs me tho,i dont understand, if object exists at construction script runtime to be editable by it,why destroy it and create new beyond that.Maybe thats because Construction script not actualy run during actual game,but cache is used , and the way to pass data to gameplay is only by caching it.
5.4 and it’s still issue, I have to duplicate the properties I want to change into actors properties and then pass it to a components setter function in construction script.
So I used the Exposed Property trick and it works, unfortunately in my case, I’m moving an Actor Child Component that serves as an anchor to indicate until which position I should spawn sub-actors in my Construction Script. This makes it really convenient to edit things visually (this is based on an old UE4 tutorial showing how to spawn pillars at regular intervals between a start and end position, which unfortunately I can’t find anymore so I don’t remember how they did it).
So the trick is to add an Editable float Distance variable to determine until where I should Add Child Actor Components - but that loses the convenience of visual editing (dragging an anchor) in the scene.