Setting widget variables does not work through construction script

Something like this does not work. The cast is succesful, the Score value gets set but is then reverted to the default value in the widget. (reverted 1 tick later, or on begin play)
The whole setup works just fine when put as begin play event instead.

Hey Davision-

This appears to be working as intended. If you’re running in PIE, what’s happening is a copy of the widget is being created when PIE starts. If you run in Standalone, you’ll see that the value set in the screenshot is maintained.


Why is then a copy of the widget created when PIE starts? Does not sound logical to me. I was using it in a blueprint actor that gets spawned at runtime and was testing it in PIE

The PIE process creates a copy of the instances in the viewport when PIE starts. When PIE ends, these copies are removed and the viewport instances are unaffected by changes made while PIE is running. The Standalone process more closely mirrors how a packaged game behaves with relation to creating objects at runtime and is a better indicator of behavior.