Ok… This is an odd one, and I haven’t yet got a working test case (and may not be able to). So, here is best description I can give so far…
Every now and then, Buttons (and other clickable elements) will suddenly stop reacting to events. This happens with both hover and clicks. This can happen anywhere in my UI, including in my login screen, start screens and in the game itself.
Sometimes, it is ALL buttons, sometimes it may just one, or all buttons in a Panel or Window.
Sometimes, you can make them start working again by hovering over another button that is working (often with a tooltip), and then going back to the broken button.
Sometimes, they don’t stop working completely, but may not activate over their full area. For example, hovering over the borders of the button will trigger hover events, but hovering over the text of the button wont.
It’s proved impossible to narrow down a single chain of events of that seem to trigger this, but parts of my game are worse than others. I can however reproduce fairly consistently in one particular place :-
- I have a LoginAppState. This adds a login screen using various elements.
- Upon login, this appstate is deactivated (the various UI elements are hidden using effects)
- The CharacterSelectAppState is then activated, showing its elements using effects.
- This means as one appstate deactivates, and the next activates, both are running effects.
- The CharacterSelectAppState has a “Logout” button. Clicking this deactivates the CharacterSelectAppState, which hides its elements using effects, and reactivates LoginAppState.
If I rapidly cycle between the two, doing login, logout, login, logout, login, logout (usually 3 times). This usually results in the buttons in the character selection stop working.
I put some extra debug output inside Screen.getEventElement() to try and work out what was happening. It appeared that the collision there is not colliding with the element at all. results is either empty, or sometimes finds the parent element instead.
Now I am guessing this is some z-order thing? I tried outputting the values of Element.getZorder() and Element.getWorldTranslation().z. The former was alway zero. The later seemed to decreases with each cycle. Whether this means anything or not I have no idea.
Sorry I can’t give you any more to go on just yet. I should say that this has been a problem for me to varying degrees for some time. I’ve been putting off trying to fix it because I’m sure its going to be a pig to solve :S
RR