Search Issue Tracker
By Design
By Design in 2023.1.X
Votes
0
Found in
2020.3.35f1
2021.3.5f1
2022.1.5f1
2022.2.0a17
2023.1.0a2
Issue ID
UUM-7678
Regression
No
Button color is not changing when hovering/clicking on it if the Background color was changed
How to reproduce:
1. Open project "UIToolkitIssue.zip"
2. Open "SampleScene" Scene
3. Enter Play Mode and hover/click with a cursor on the "Button" Button
4. Observe the Button
5. Exit Play Mode and open "Menu.uxml" file (Assets > Resources > Menu)
6. Select Button and change the Background color
7. Save UI Builder and repeat the 3rd and 4th steps
Expected result: Button color changes when hovered/clicked
Actual result: Button color is not changing when hovered/clicked
Reproducible with: 1.0.0-preview.18 (2020.3.36f1), 1.0.0 (2021.3.4f1, 2022.1.5f1, 2022.2.0a17)
Could not test with: 2019.4.40f1 (Errors after project downgrade)
Reproduced on: macOS 11.6 (Intel)
Note: Reproducible in the Editor and in the Player
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
When assigning the background color by clicking on the element in the UI builder it will set the color directly in the Uxml, this is considered as an inline style. This has precedence over styles coming from USS. The default runtime time is using the selectors ".unity-button" and ".unity-button:hover" which does the hover effect.
Since the color was assigned in Uxml the ".unity-button:hover" will not be applied and the color will remain the same. The solution is to use USS to set the background color of the Button.
Resolution Note (2023.1.X):
When assigning the background color by clicking on the element in the UI builder it will set the color directly in the Uxml, this is considered as an inline style. This has precedence over styles coming from USS. The default runtime time is using the selectors ".unity-button" and ".unity-button:hover" which does the hover effect.
Since the color was assigned in Uxml the ".unity-button:hover" will not be applied and the color will remain the same. The solution is to use USS to set the background color of the Button.