How can I destroy my Widget Class after 3 seconds? (Or Hidden)

Hi, I’m developing small VR contents with Unreal Engine 5.3 and using Blueprint.

I wanna destory my Widget after 3 seconds.

My work that I spawn and show widget in the view works well.

But Idk why the destory method doesn’t work.

The weird thing is that it only works on the first run,

and then only when but not on the second and third runs.

Is there anyone who can help me?!


What does not work?

This shows the actor. Tick the box to hide it. If it does not work, there’s something else affecting the actor we cannot see here.


Besides that, no need to faff around:

No script is needed to destroy actors with delay, use Life Span:

image


And to clarify, you’re working with actors here, not widgets. Since this is VR, it’s most likely this kind of thing:

Actor → Widget Component → User Widget


and then only when but not on the second and third runs.

You keep spawning a brand new actor every time there’s an overlap. If the actor does not get destroyed before a new one is created, you will deference and orphan the previous one. Perhaps spawn it only once, and then show / hide only.

2 Likes

Thanks for your solution.

I applied your solution and it works well :slight_smile:

Thank you for not only providing the answer, but also for the additional points.

I’ve gotten help from you twice already, and you’re the reason I’m not giving up on Unreal. :smiling_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.