Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4
2019.4.14f1
2020.1
2020.2
2021.1
Issue ID
1295638
Regression
No
Array field not deserialized (null) when ScriptableObject loaded via UnityEditor.AssetDatabase
How to reproduce:
1. Open the attached project named "EnumArrayReport.zip"
2. Open and Play the Sample Scene
3. Observe the Console window
Expected result: Debug.Log prints - Base.Platforms.PlatformType[]; System.Collections.Generic.List`1[Base.Platforms.PlatformType]; UnityEngine.Vector3[]
Actual result: Debug.log prints - ; System.Collections.Generic.List`1[Base.Platforms.PlatformType];
Reproducible with: 2018.4.30f1, 2019.4.16f1, 2020.1.16f1, 2020.2.0b14, 2021.1.0a9
Notes:
1. The correct log is always printed if the ScriptableObject (YOE_YearOneEditionEntitlementDef) is selected and displayed in the Inspector Window. It may also be correct once it is deselected for one or two test runs. However, repeated attempts with the SO unselected will result in the wrong error message printed
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] “ReleaseButton expects buttonId >= 0” error is thrown when importing Assets via drag and drop
- [Linux] Numeric field value stops increasing when cursor reaches the edge of the monitor while dragging
- Asset gets unselected and added Subgraphs list item is not undone when performing Undo in Heatmap with Default Values asset Inspector
- Black square “shadow” artifacts visible when using Screen Space Reflections without maximum smoothing
- UI counter displays incorrect collectible count when using "Remaining_Collectibles_UI" Prefab in "Get Started With Unity" template
Resolution Note (2021.2.X):
The issue is that the asset was created with a version of the script which did not contain the array fields. The difference between the selected version which is done in the inspector is that the SerializedObject which is constructed for the inspector needs to initalized null arrays so they can be manipulated. However this is set on the specific instance in memory and when you load over it you will lose it again. An alternative if you need those to be non-null is to initialize them in Awake if they are null.