This is a bug that I can see since a long time ago.
I have a UserWidget, with a custom property marked as “Expose on spawn” and “editable”
Here you can see i´m adding pawn (current player) reference, so it´s impossible to have it empty, as he is the one creating the widget.
Intermediately created, if you try to read property “Heroe Base Actual” will be null… it´s like exposed on spawn fields are not took in consideration, but just for user widgets, for blueprints work ok.
Also, If I set SELF as a second step using the ReturnValue.HeroeBaseActual = self, it works ok, it just fails while using it on expose on spawn.
Tested today 09.2020 in 4.25, still not getting “Expose on spawn” properties passed to widget. Bug still exists after years or i am doing something wrong?
Can confirm. Still some weird/undefined behaviour when trying to use “Expose On Spawn”-set variables inside the Construction Script of a widget. Sometimes it actually seems to work, and then it starts failing again without touching it (e.g. after restarting the engine/editor) .
Exposed on Spawn Variable won’t be accessible in event “On Initialized”. Adding a 1 frame delay solves the issue, but then other functionality needs a 2 frames delay and this scales up…
I’m on UE5.4/5.5
For me the the exposed variables are the class default values when OnInitialized executes,
but are correct when PreConstruct executes
OnInitialized only executes once (you have to add the node yourself in the graph) PreConstruct and Construct execute every time the widget is added to the Viewport or a Panel widget (Canvas Panel, Overlay, Horizontal Box, …)
Some oddities:
If I use the ConstructObject node to create the widget, the OnInitialized event is not executed
If I use the CreateWidget node the OnInitialized is executed
If I use the CreateWidget node and execute AddToViewport in the widget on the OnInitialized, the OnInitializedwill be called twice in this order: Init, PreConstr, Constr, Init, [continues behind the CreateWidget node]
@macxike what do you mean by “Create and Add Widget”? Is that a single node?