How do I keep this function from overwriting its own reference?
I have one function that takes an FString as input, throws it into a random text block in my UMG widget, sets the overlay panel that text is in to visible, and returns a reference to the overlay panel. I then have a second function which just takes an overlay panel as an input, and sets it to hidden. By combining them with a relay node in the event, I effectively have a system that displays a bubble for an arbitrary period of time, then hides it again:
This works if bubbles appear slowly, but if numerous bubbles attempt to spawn one after the other, whenever SaySomething assigns new text to a bubble that's already visible (and thus, waiting to be hidden), that bubble remains visible.
Is there a simple way I can prevent this behavior? Since a reference to the panel I want to show/hide is being passed each time text is assigned, I didn't expect this to freeze a panel in the visible position to begin with, so at the very least I would really appreciate some help spotting where my mistake is that's causing things to remain stuck with visibility set to true.
asked Aug 01 '15 at 02:12 AM in Blueprint Scripting
you have a manager controlling all the widgets like puppets, but if you want the widgets to die after a while, they should keep track of their own lifetime.
answered Aug 01 '15 at 07:14 AM
in your function "Say something" create local variable and store value here, then return it's value, in this case every call of this function will make own variable and return it's value preventing override
p.s. don't forget mark question as answered with little gray circle button under any answer (not comment, but whole answer) when problem solved, so anyone else later can have same question and may find solution faster, if you find solution on your own, don't forget write it too
answered Aug 01 '15 at 02:38 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here