x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I prevent a button from being spammed?

Hey I hope everyone is doing well.

I have a UMG menu that plays an animation of the menu being lifted off the screen like a piece of paper when you exit the menu. My game is for android, and recently I added functionality for the android back button, when I realized my method to deal with the button being spammed or hit repeatedly while the animation played wasn't working. Below is my attempt.

alt text

And that bool 'hasBackBeenHit' is set to false on event construct. Is there a standard way I should deal with this that I'm unaware of? It's like the user is able to cause my animation to start over by spamming the button.

Thank you so much to anyone willing to take the time to help.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 24 '19 at 05:53 AM in Blueprint Scripting

avatar image

geekTechnique
83 2 6 11

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

Maybe you can use DoOnce macro. You can trigger Reset pin of DoOnce after your animation finished. I couldn't imagine your workflow in my mind but you can use DoOnce on anything to block spamming.

more ▼

answered Jan 24 '19 at 07:38 AM

avatar image

M.FatihSaglam
118 4 5 8

avatar image geekTechnique Jan 24 '19 at 08:13 AM

Thank you SO MUCH! This worked perfectly, easily, the first time I tried to implement it. I really appreciate you.

I will accept this as an answer if you want to do change your comment to an answer.

avatar image M.FatihSaglam Jan 24 '19 at 09:28 AM

Sure why not :)

(comments are locked)
10|2000 characters needed characters left

Let me know if this solves the issue.

backbuttonhelp.png (104.0 kB)
more ▼

answered Jan 24 '19 at 08:44 AM

avatar image

Debaucher
46 5 7

avatar image geekTechnique Jan 25 '19 at 02:12 AM

Thanks for your answer. I really appreciate the detail. This is a great example of what I wanted, but Saglam gave me a very similar answer first. I'm not sure what the protocol is, to whom to give the 'best answer', but I gave it to him before your comment. I'm just writing you to let you know that I appreciate your work.

avatar image Debaucher Jan 25 '19 at 05:34 AM

I didn't notice his response and just wanted to give you an image. Thanks for the response!

(comments are locked)
10|2000 characters needed characters left

No, there no standard way to do it. If your menu widget is just hidden not destroyed, only thing you could do better is to have general menu state bool and set to false when dissaper animation is start playing and set to true when appearance animation finished and use that bool as a filter to any menu related events if needed, including back button.

more ▼

answered Jan 24 '19 at 06:05 AM

avatar image

Shadowriver
34k 916 164 1093

avatar image geekTechnique Jan 24 '19 at 08:08 AM

That's exactly what the hasBackBeenHit bool is for.It doesn't seem to work. And just to clarify, I use "remove from parent" after the animation completes. I mean, it kinda works. But it's still spammable a little.

But let me say thank you for your input. I appreciate your interest in my question.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question