Hi, every time i hit an object, that object creates its own widget (A) for 5 seconds, then it dissapears, the problem i have is that, if i hit a second object before the first widget vanishes, it creates a second widget (B) on top of the first one, to fix this i want to delete every widget from scene when ever i hit one object (A), this Will remove all widgets and keep the widget created at that second…BUT… doing this, also removes my main character widget (C) so i also loose that widget LOL… I already tried to remove from parent each widget type… but i have tons of widgets… so its been really complicated.
How can i remove all widgets, but keep one (C) active?
Not sure if this will work for you, but one way would to create a function on your character BP or a BP Function Library, that gets all of your widget references. What you would do is create a Bool Input for each widget within that function and tells them to remove from parent if Not Ticked (this way you tick just the one you want to keep). Then you just reuse the 1 function whenever you need to and just add to it if you add more widgets.
Then you just create 1 more function which readds them to the viewport when needed.
Now the above is not practical if you have too many.
Otherwise, you could always use the Remove All Widgets and then recreate your Main Character Widget again after it. Put this in its own function to make it easy to use.
You could also just create the widget when the actor is created rather than when it is hit and simply show and hide the widget. You could create show and hide events in your actor where you determine if it needs to be shown again and add or remove from the viewport as desired.
Otherwise, you could store all the object widgets in an array but exclude your widget from the array and loop through to remove.
I think the first solution I suggested is more elegant though
Ii was using show and hide for some, but…. my enemies move very fast LOL, so i can hit several very fast, or even without wanting to hit them i might hit them… then the same widget of the same character type, appears again and again… and by the way you explain the function ideas, i think it Will be very complicated, there is no easy way i guess.
What i want is that this new widget stys for some seconds the hide, but…. it another one is hit another widget appears and hide the last one… but do this and still keep my main widget… if not, hiding all Will also hide main widget.