on beginplay create a widget, the widget has an Add to Array on the construct. if i dont do a add to viewport and instantly remove from parent the add to array never executes, its like if it needs to be “activated” by adding it to the viewport (using Set Input Mode Game and UI worked too). Tested using a dummy Print String “Hello”, doesnt displays anything either, but if i set the Add to Viewport, it shows the string inmediatly after Widget Creation.
From what I know it’s imperative to add to viewport, I think if you want to keep this structure, you’ll need to create «text» when we press C.
But I think it’s would be a nice feature to add. So we can set whatever Widget and add it to viewport when we want.
Just bumping this and adding that it only fails when the construct has an array instruction, regular instructions works fine.
fixed in 4.12
This bug still exists on 4.12, just to let you know.
thats weird because my original issue was fixed on 4.12.1 (or preview) and its broken again on 4.12.2. i didnt notice it broke again because i decided to keep the workaround (custom event after create widget) to avoid exactly this…
I think this is back in 4.19, can anyone verify? I’m experiencing something very similar.
Running into it on current. 4.21.2
Really annoying.
In the end it’s a matter of copy/pasting code from the widget construct to the parent blueprint - it’s just really not code effective, “proper”, and i’m blowing a gasket to think about it in the incorrect terms it’s in.
The “event construct” is supposed to happen when the event is created, not when the event is added to X… that’s instantiation vs construction… OOP 101 if not even remedial.
The same happens with Pre Construct or On Initialized. looks like i’m SOL in terms of creating a recursive widget without creating my own event…
On the plus side, I guess it’ll work better with a custom event.
Actually
Even more puzzling.
Creating Breaks and iterating through the code shows that the events are call as one would expect, on construct.
Yet the variables are all set to “NULL” even though the parent creating the item is customizing the variable.
then the same code gets run AGAIN once the event is added to the view-port.
At this point I think maybe it’s my exec sequence on the print that’s out of whack rather then the engine bugging out. It can’t be running the same event initialized twice… that’s just too big an oversight.