UMG widget On Remove event

Hey all, I can’t seem to find an event that is called when a widget is removed by it’s parent, so if a widget requires any clean up I have to call this manually whenever I call Widget->Remove from Parent. Does anyone have a way of executing a graph when a widget is removed?

What do you mean “executing a graph when a widget is removed?”

What I mean is I want a blueprint entry point for when the widget is removed from the parent, like an event or a delegate. I can’t find something like that and I was wondering if I was missing something.

Actors for example have a Event BeginPlay and Event EndPlay. Widgets have the Event Construct which is similar to BeginPlay, but no corresponding one for when it’s lifetime ends.

I would be interested in having such a feature for this as well. I hope widgets get this functionality soon, because it would make unbinding an event dispatcher for me much easier to do.

You mean removing the widget from the viewport?

That is exactly the issue I’m struggling with. :slight_smile: Widgets having no easy “OnAdd/OnRemove” event pair makes it difficult to make sure everything is cleared up after the widget is no longer in use. Event dispatchers as well in my case.

Hi there! Maby thats thread is too old, but Im live an answer here:) Widgets has Event Construct and Event Destruct so thats pretty same as OnBeginPlay and OnEndPlay. So maybe, thats a solution:)

You can’t rely on that, you don’t know when the garbage collector will be called so it’s not the same a native removed from viewport event would be.