Search Issue Tracker
Won't Fix
Votes
0
Found in
2019.4
2020.3
2021.2
2021.2.0f1
2022.1
Issue ID
1376739
Regression
No
Declared default values of a class are ignored when declaring it in another class
How to reproduce:
1. Open the user's attached "2021 Empty" project
2. Open the "Test" Scene
3. Select the "Main Camera" GameObject in the Hierarchy
4. Observe the "New Behaviour Script" Component in the Inspector
Expected result: The "Test Generic" and "Test Inherited" fields' values are the same
Actual result: The "Test Inherited" fields' values are correct (i.e., the "Value" is equal to 7 and the "Default Value in Generic" is equal to 15), whereas all the values of the "Test Generic" fields are equal to zero
Reproducible with: 2019.4.34f1, 2020.3.25f1, 2021.2.7f1, 2022.1.0b2
Note:
- The default values are visible from a child class
- Resetting the Component doesn't fix the issue
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
- Tile Palette selected dropdown text does not update when palette is renamed
- ArgumentException thrown and reference to Template gets unset when opening UXML file after editing referenced Template in Play mode
- [iOS][WebGL] Player freezes when multiple properties of a VisualElement are changed at the same time
- Warning 'GetControlID at event ValidateCommand returns a controlID different from the one in the Layout event' is logged when undoing the deletion of an Edited Freeform 2D Light
- ShadowCaster2D breaks on certain Rotation positions when Casting Source is set to PolygonCollider2D
Resolution Note:
Serialization of generic is unfortunately not supported at this time as mentioned here https://docs.unity3d.com/Manual/script-Serialization.html
How to ensure a custom class can be serialized
Ensure it:
Is not generic, though it may inherit from a generic class