Search Issue Tracker
Fixed
Fixed in 2021.3.23f1, 2022.2.14f1, 2023.1.0b12, 2023.2.0a8
Votes
0
Found in
2020.3.44f1
2021.3.18f1
2022.2.5f1
2023.1.0b1
2023.2.0a4
Issue ID
UUM-28904
Regression
No
Inconsistent behavior of EnumField initialization when an Enum type is used as a generic type
Reproduction steps:
1. Open the attached project “EnumProject”
2. Open the “Assets/EditorTest.cs” script and observe both variables (v1,v2)
3. In Unity’s Main Menu open “SSCCE>Show Test Window”
4. Observe that the first(v1) enum field has no default value displayed in the “DefaultNamespace.EditorTest” Window
Expected result: Value “A” is displayed in the first(v1) enum field
Actual result: No default value is displayed in the first(v1) enum field
Reproducible with: 2020.3.44f1, 2021.3.18f1, 2022.2.5f1, 2023.1.0b1, 2023.2.0a4
Reproducible on: Intel macOS 13.2
Note: The variable “v1” utilizes the static type “Enum” as a cast. The issue seems to be with using the Enum type as a generic type. When the EnumField's Init method is called with the Enum type, it is not able to determine the specific enum type at runtime, so it is unable to correctly display the value in the editor. By using a specific enum type instead of the Enum type as the generic type, the EnumField is able to correctly display the value.
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
- [Linux] Crash on System.Runtime.InteropServices.Marshal:copy_from_unmanaged_fixed when accessing shared memory
- Misaligned text in Preferences window > 2D > Animation, Asperite and Sprite Editor preferences
- Unable to Install ZivaRT Player deprecated package
- Inconsistent Label Popup UI in Package Manager
- All active Audio Sources play their Clips when the "Play On Awake" checkbox is enabled and Scene view Audio is unmuted
Resolution Note (fix version 2021.3.23f1):
Fixed 2021.3.X: Inconsistent behavior of EnumField initialization when an Enum type is used as a generic type