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
- Scene/Game view visually breaks and console is spammed with errors when using DepthBlit Sample Scene
- "GetOrAddComponent" method in "Unity.VisualScripting" returns "MissingComponentException" error when the "BoxCollider" Component doesn't exist
- Render Graphs Kebab Menu Buttons are missing padding and Highlight is uneven when hovered over
- Shader Keywords are not detected when defined in include files
- Right-clicking on Blackboard and Graph Inspector calls the contextual menu of the workspace
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.