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
- Alt+click on List header does not recursively toggle child foldouts when items use a UI Toolkit CustomPropertyDrawer
- Hub Window is closed when closing Unity AI Window via the OS Window Close Button on Windows
- Artifacts are rendered in UITK when using Font Assets and using negative outlines
- Editor hangs when opening Asset picker window for AssetReference and a lot of addresable assets are present in the project
- Text with Legacy Font Asset is not rendered
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.