Search Unity

Bug: .class:active and .class:hover cant be combined

Discussion in 'UI Toolkit' started by Nikolai-Games, Apr 20, 2021.

  1. Nikolai-Games

    Nikolai-Games

    Joined:
    Sep 14, 2019
    Posts:
    6
    Hi guys,

    Versions: Unity 2020.2.2f1, UIToolkit 1.0.0preview.14 march 20 2021



    I assume there is a bug in the toolkit.
    When you create a uss-class for :hover and :active state for a button with diferent background images, it is not working, the active state does not dominate the hover-state, when clicking.

    In single they work.
     
  2. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    575
    Hi!

    There are multiples rules that applies to witch selector has precedence. Sharing more context would help us understand what stat you are in.

    The last selector defined in the uss should "win" over the other one. Depending on the order in which you :hover and :active have been defined it would change the behavior.
     
    Nexer8 likes this.
  3. Nikolai-Games

    Nikolai-Games

    Joined:
    Sep 14, 2019
    Posts:
    6
    Normally, the order in uss shouldnt define the behaviour, because :hover means moving the cursor over the button, and :active means clicking it. But when clicking the :active-style does not dominate the :hover-style, as it should be.
     
  4. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    575