Widget Button Animation Is Replayed With Space Bar

First off, this is not a question, it’s a fix. I just didn’t know where to put this so here it goes.

I was creating a widget to show controls that wouldn’t interrupt gameplay.

It is just a small button in the top right of the screen that said “To Show Controls Press Here.” Once clicked it would make that button fade away and a new border contained box showing all of the controls would slide in from the right, also containing a button to close that new box showing the controls.

It worked fine and I was happy with it until I noticed that pressing Space Bar, which is a gameplay control, would replay the last animation of the widget that was played. This would happen for either the onClicked animation that would fade the button and show the controls, or the button to hide the controls box.

I was able to fix this by adding a Set Focus to Game Viewport action right after the onClicked event.

I think this would also work by putting the Set Focus at the end, I don’t remember.

Hello b16redlined,

If you set the “Is Focusable” setting for the button used to play the animation to false do you still have this issue?

Make it a great day

1 Like

Yup, this is probably the correct way of doing it. If I would have read the tool tip I would have seen that, thanks.

Any reason why Space Bar seems to trigger it to replay while in focus? I just think it seems a bit odd.

Hello b16redlined,

The space bar just happens to be the button used to activate the currently selected button. I am happy to hear that this worked for you.

Make it a great day

Wow I just had this issue and it was driving me crazy, this was the solution and i’m glad it was simple once I knew what to search for.