I have this in my scriptable object:
[SerializeField]
public AnimationCurve[] scaleCurves;
In my original object, some of the array elements are null.
When I load this object later, all my null curves have been replaced with animation curves that evaluate to 0.0.
This happens in Unity 2019.4.36f LTS.
Here’s how the serialized array looks like with 3 null curves in it:
scaleCurves:
- serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
- serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
- serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
So I’m guessing that’s the issue - since array element is null, serialization creates 3 empty entries in asset file. Then, during deserialization it actually creates these objects, but does not fill them with any data.
If you have problems reproducing it, let me know.