How do i remove a widget from the viewport

helped me out guys. get all widgets of class - remove from parent

thnx a lot

Thank you very much! Get all Widgets from Class works just fine

Use “Remove All Widget” But Add A Delay Before It, So You Give Your Said Widget Time To Spawn, Then To Be Removed,

Widget Set Visibility

It helped me in 2022

1 Like

Still a valid solution in 2022

Remove from Parent Node not work in UE5 :confused: Only way to make it work (it seems):
Use Visibility to show/hide the widget or use array and bet the array is correctly processed

It does work (testing in 5.0.3 AND 5.1.0)

Also, you can choose, specifically, which asset you want to destroy (even if shared class) by setting it as a value, using the “==” evaluator, and setting the subsequent branch condition to the set object (any object) value and then looping it from FALSE (I didn’t bother, this is just for demonstrative purposes).

There’s likely an easier way, but this is how to use the “Remove From Parent” without removing every widget of a single class.

Everyone here is finding work arounds and fixes but no one is really addressing the reason it’s happening. In my case when I use print string to pinpoint the issue, my analysis implies that the widget is double activating, and the Destroy from Parent is only destroying one of them, leaving the second one permanently attached. This is why Remove All works. I don’t know what is causing the double activation, maybe the press and release is activating the button. And if we look back to the OP, this multiple activation was actually their issue also.

The easy fix that kind of confirms my theory is that I added an If statement before the create widget and a bool within the widget to turn on when the widget activates and turn off when the widget destroys. The if statement is triggered by that bool. This fixes the issue.

That’s wild I only do things “on release” to prevent these type of double inputs

1 Like

That’s what was doing it. I had both Press and Release for my triggers on the Enhanced Input Action I had made. It was triggering from both.

1 Like

I’ve been researching a related problem for over an hour, and your solution (Get All Widgets Of Class) solved it for me. Thanks!

Thank you so much! <3

thanx man, your method still works like a charm

Thanks for this thread, in my case, I had to do several things to properly remove the widget:

  • Remove From Parent
  • Set reference to widget to null
  • Collect Garbage.

Works now. Daaang.

image