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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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