Search Issue Tracker
By Design
Votes
0
Found in
2019.3.0a3
2019.4
2019.4.7f1
2020.1
2020.2
Issue ID
1269588
Regression
Yes
GUI.Button and GUILayout.Button stay in the normal GUIStyleState even when the normal GUIStyleState is changed to another one
How to reproduce:
1. Open the user's attached "GuiButtonStyle2019.4.7f1.zip" project
2. Open the "SampleScene" Scene
3. Open the "TestInspector.cs" script
4. Observe the script and notice that the normal GUIStyleState is changed to active (line 12) and is applied to the two buttons (line 15, 16)
5. Go back to the Editor
6. Select the "GameObject" GameObject in the Hierarchy window
7. Observe the three buttons in the Inspector
Expected result: The active GUIStyleState is applied to the normal GUIStyleState for the two upper buttons and the buttons look like they are pressed
Actual result: The normal GUIStyleState is not changed to the active GUIStyleState for the two upper buttons, buttons look the same as the lowermost button
Reproducible with: 2019.3.0a3, 2019.4.8f1, 2020.1.2f1, 2020.2.0a20
Not reproducible with: 2018.4.26f1, 2019.3.0a2
Notes:
- The active GUIStyleState was used as an example, but no GUIStyleState on a button can be applied in the reproducible versions (stays in the normal GUIStyleState)
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note (2020.2.X):
With the introduction of NorthStar theme the way styles work had been updated and the styles no longer use images for backgrounds, instead it uses background color. If you wish to achieve the same behavior as before you can do that by using the background images which are still in resource bundle else you can create a new uss file for your style which is recommended for new theme.
Here are a few reference that might help:
https://docs.unity3d.com/Manual/class-GUISkin.html
https://docs.unity3d.com/Manual/class-GUIStyle.html