How do I remove a widget when i click at a random place?

Hello Guys, I’m adding a widgets on the screen when you click on specific mesh. My question is, how can i manage to remove this widget from the screen when i click anywhere but the specific mesh? I need to make ‘on click events’ for everything on the scene but the specific mesh and delete the old mesh on click? Or is there some other more professional way?

You can look at InputComponent, there is an event for touch, but you can also use it with a mouse click. So when that fires you trace stuff under the cursor, and if it doesn’t hit your mesh you remove that widget.