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
- After converting a Built-in project to URP render texture related errors are spammed that can lead to Game view being rendered on top of Scene view
- UI Builder slider value lags and stutters when sliding/modifying certain property values
- "Reset UI Builder Layout" functionality inconsistently changes Canva Size when "Match Game View" is enabled/disabled
- Texture Import Warnings are obscured by other Terrain Layer options in the Inspector
- Burst Inspector middle divider is jittering when resized with the Burst Inspector window docked
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.