Pre Construct in Widget start loop twice - should once

Hello

I found weird problem, maybe my fault but…

Here on Pre Construct loop for creating menu slots. I did like this many times without errors.

But this time, menu creates twice (even three time sometimes). I was sure this is error in my Inventory function (pure, above loop) but when I add debug slot with info about list/loop end, I see it start loop twice… adding slots again. For now solution is to add ‘Do once’ before loop, but before, in my case it was never required.

I miss something or bug? I lost some time with it being sure I made a mistake in the function;)

Hi there,
Is this duplication happening every time you open the inventory menu? It might be necessary to get wrap box 63, connect to “clear children” right after Pre-construct, then “remove do once”.

Not sure what those nodes on completed do, but it seems only for debugging, correct?

Menu shows on button click. Is specified inventory only Player. Here different container, but on inventory menu starts, and click to show menu is later -when you click :slight_smile: Anyway, other cotnainer - removed from parent (on start, for other tests), have own button for click/open menu and other inventory defined, but here listed player inv twice.

And strange ‘Do Once’ helps, I never used it in Widgets before as I remember

After remove from widget this other container, it still happens.

I just ran into almost the same issue today… No idea what happened but Event Construct is firing twice. At a complete loss. Happed last night but was able to fix it by restarting PC and recreating the widget but now it happened again and my only fix is to have a do once on Event construct.

Have you checked if the button click is triggered only once, when you press the button?

So basically what I am doing is interacting with an NPC that displays a shop widget. Confirmed that the interaction function is fire once but Event Construct fires twice. It WAS working and then next morning broken so idk…

Create widget on interact

Shop widget

With do once

without do once

Kind of hard to see but it stacks itself. Funny because it was 3 times last night and now twice.

I had the same problem. The second execution of the constructor called the method “Set Input Mode Game And Ui”. If you call it before adding a new widget to the slot. If you call it after, the constructor will work once. Or just do not pass the variable In Widget To Focus.