Wait for a widget to close

Hello, I’m making a function that opens a widget with custom properties and it should also wait for the widget to close and then finish. But I don’t know how to wait for the widget. Any suggestions?

You will not be able to do it in a single function unless said function is latent. If you want to do this purely on blueprints what you can do is in the object that calls the function have actually two funtions:

One for Starting the process (showing the widget)
Another for when the widget gets closed.

You can create the widget and pass a reference of the calling object to it, so the widget can call the second function the moment its closed. Or you can create an event dispatcher on the widget that gets called when the widget is closed, and subscribe to it from your original object/actor the moment you create the widget.

Both ways should work. The third alternative is creating a custom latent function, that will requiere C++. If you want more information on how to do that let me know and I can point you into some documentation and tutorials about it.

Hope this information helps you. Make it a great day.

Thanks for the answer