I noticed that when a UIToolkit-powered Button is tapped on iOS, it remains in “:hover” state, which is quite annoying because the button retains the associated :hover style even if the user stopped interacting with it. I could reset the USS :hover style attached to it, but I would loose this style it on desktop application where I want to keep the :hover style because the player uses a mouse (and :hover style is relevant in that case).
What I could do is create a workaround by having two USS classes:
.mobile Button:hover {
# Reset the style
}
.desktop Button:hover {
# Have a style (e.g. darker background color tint)
}
And then in OnEnable, detect whether I am on mobile or desktop and apply the class accordingly, but it looks quite complicated just to accomplish something that simple.
Am I the only having this issue? Did I miss anything?
Hello @griendeau_unity and thanks for answering my message. Please find the requested info bellow:
Unity version: 2020.3.2f1 (but I had this problem back in previous versions of 2020.x.x, not sure exactly which versions though, I could find this in my Git history if necessary). I also temporarily upgraded to 2021.1.0f1 (which I eventually downgraded for other reasons), and the problem was there.
UI Toolkit Package version: Version 1.0.0-preview.14 - February 09, 2021 (latest).
Input System: Both
Following your message, I decided to try enabling only the new Input System and I don’t have this issue anymore (I did that in Project Settings > Player > iOS > Active Input Handling to “Input System Package” instead of “Both”). However, I can’t interact with UI using Unity UI (I still have a couple of scenes using it).