Is that normal OnValueChanged event is firing before the Event Construct in an UMG widget?
I thought Construct event was supposed to be the equivalent to Event Begin Play in normal BP, so it should be called before everything else in the widget BP but seems it’s not the case.
The result is I have an “accessed none” error as my player controller is set in Construct but needed to find a value in an OnValueChanged of a SpinBox in the hud widget.
Seems wherever I use a Player Controller variable referencing my player controller in the widget, it’s the last place where I use this PC var that brings the “accessed none” error. The previous place bringing the error doesn’t do it anymore.
So should be definitively a bug.
Anyway I find a workaround: PC var in the widget have to by “expose on spawn” on true and the reference PC plugged in the create widget node.
This ‘bug’ caused me other forms of grief. I discovered that the UMG SpinBox Widget ‘OnValueChanged’ Event fires after calling the ‘Add to Viewport/PlayerScreen’ BP Function.
Workarounds are case by case, but, the a generic temp fix is to create a bool variable ‘IsEventConstructed’ that represents a T/F State set to TRUE by the EventConstruct Event when fired. This IsEventConstructed Bool is placed after the OnValueChanged event using a Branch Node to Fire. Collapse the Bool + Branch to a Macro for cleanliness.