Search Issue Tracker
By Design
By Design in 6000.0.X
Votes
1
Found in
2020.3.16f1
2021.1.17f1
2021.2.0b7
2022.1.0a5
2023.1.0a1
2023.2.0a1
2023.3.0a3
6000.0.0b11
Issue ID
UUM-3438
Regression
Yes
Button doesn't appear as toggled/activated when using GUIStyle with GUI.skin.button.active.background
How to reproduce:
1. Open the attached project's Scene labeled "SampleScene"
2. In the Hierarchy, select the "ButtonsManager" GameObject
3. In the Inspector, click the custom button
Expected result: Button changes the background when clicked
Actual result: Button's background doesn't change when clicked
Reproducible with: 2019.3.0a3, 2019.4.29f1, 2020.3.16f1, 2021.1.17f1, 2021.2.0b7, 2022.1.0a5
Not reproducible with: 2019.3.0a2
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:
The Editor has undergone a very large visual redesign between 2018 and 2019, including using colors instead of textures to draw GUI button backgrounds. As such, both GUI.skin.button.normal.background and GUI.skin.button.active.background are identical (and null) and can't be used to implement the user's intended behavior.
There are a few solutions available as a workaround:
* Assigning any other texture to the GUIStyle.normal.background property will work as intended
* Using GUILayout.Toggle with "Button" for the style argument, which is made for this exact purpose. For example:
_pressed = GUILayout.Toggle(_pressed, _pressed ? "Change to N" : "Change to A", "Button");
* Upgrading your inspector to UI Toolkit, which has been the recommended solution for Editor content since Unity 2021
Resolution Note (6000.0.X):
The Editor has undergone a very large visual redesign between 2018 and 2019, including using colors instead of textures to draw GUI button backgrounds. As such, both GUI.skin.button.normal.background and GUI.skin.button.active.background are identical (and null) and can't be used to implement the user's intended behavior.
There are a few solutions available as a workaround:
* Assigning any other texture to the GUIStyle.normal.background property will work as intended
* Using GUILayout.Toggle with "Button" for the style argument, which is made for this exact purpose. For example:
_pressed = GUILayout.Toggle(_pressed, _pressed ? "Change to N" : "Change to A", "Button");
* Upgrading your inspector to UI Toolkit, which has been the recommended solution for Editor content since Unity 2021