#Widget removing

1 messages · Page 1 of 1 (latest)

fresh briar
#

@plush kernel @rain creek I've made thread for less spam

#

and in the widget where it works in both scenarios it happens only once in contruct

rain creek
#

if it happens twice in the first screen, the it means only the last added widget (cause the variable is set to the new one, and the previous delay gets updated with latest variable is removed,

also i don't use on construct myself usually because i don't 100% understand how it works, but the logic runs usuall more than once and 99% of time my logic is Initialization that should happen only 1 in a life time).

on construct runs basically every time the game thinks the widgets needs to be constructed, like if you add it to viewport, if you add to some panel etc.

#

if you changed OnConstruct to Initialize(custom event) then you would not have this problem

#

like it's stupid but this screen above runs 2 times (is it going from Button OnClicked or from OnConstruct?)

#

then inside it you see only 1 remove because it got refreshed and the delay runs ONCE (but 2 widgets were created)

#

and then you see 2 times construct cause of 2 widgets

#

don't take my word for it but it's like OnConstruct will run once when you create widget, and 2nd time when you add it to viewport

#

but in reality you wanted it to happen once:
Create Widget -> Initialize

plush kernel
#

create a custom event

#

call it instead of removing

#

thats how i do it, works every time

#

instead of construct

#

just do custom event

fresh briar
# plush kernel just do custom event

If it's set up like in the screenshot above, it runs once in both widgets. However, it doesn't actually remove anything, nothing happens except for the print string.

If I move it to the Event Construct of the created widget, it works as expected, but I see the "Construct" print appear twice.

What's strange is that in the second widget, where it works in both scenarios, the removal works both when using the setup from the screenshot and when using Event Construct, and the "Construct" message only prints once.

I don’t have any issue getting it to work, and your suggestions to create a custom event are totally valid. I was just asking because I’m still new to Unreal, and it really bugged me that I could copy-paste the same nodes into different widgets and get different behavior and I don’t understand why that happens.

plush kernel
rain creek
#

maybe this will help

#

start from 1 on the New Variable

plush kernel
#

"This behavior is inherent to the "Delay" node's design, as it functions as a single-instance timer for a specific execution path. To achieve multiple, independent delays or timed events, alternative methods are required"

#

-google ai