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
- 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 (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.