I have a global standard User widget. It contains a child user widget, ‘options’ placed via the designer.
In the widget ‘options’, I create a global variable “array of text” and put default items “A,B,C” (does not matter which). In the game, after clicking a button, I do a foreach on that array to print and get only 2 items: the first value and an empty string, debug shows the same. I’ve created new variables, an array of text and string, the bug persists. Ilso, I’ve noticed that if I change text in the items, foreach print string shows the very first text.
Than happens only in that child widget, in the parent no issue
Hi there,
From the top of my head and as a gut feeling this feels like a stale widget / array default data problem. The child UMG (options) can be corrupted or stale.
I would try first, re - placing the child widget. Like entirely remove, remove /disconnect possible bindings even refresh all nodes, compile save. Then place the child widget and rebind your scripts, see if the data changed.
Secondly on the child widget (options) that you have array, rather than using default data maybe in Construct you can make an “EnsureData” function that creates the array again. Even I generally tell child with a Create function like CreateList(Array Text) and it does whatever it needs to do. So data propagates directly from the author parent (however its a preference). OnPreConstruct there can be stale data cause of execution order but really depends on your scripts.
Thirdly (I think this is a long shot but still), let’s be sure in the scripts nothing breaking the loop. Like a second button trigger that can cut the loop, a function that runs OnFocusLost etc. Just in case to be sure if something is breaking / leftover somewhere. I would directly add the child into a new blank UMG as child and test if there is a corruption or run as solo to check diagnose the culprit.