I have a class where I serialize an array of a list of a custom class (List<ClassA>[ ]) and an array of such class (ClassA[ ]). The problem is that first collection (List<ClassA>[ ]) is serialized properly, but the second one is not.
I will attach two simple scripts which you can use to reproduce it. You add those scripts to a Unity project and then you create a (Serialized)ScriptableObject by (right-clicking in Project tab)>Create>Test>OdinTest. You will apprecite that collection1 (array) and collection2 (list) variables don’t serialize the two-dimensional integer array from the custom class, but the collection3 (two-dimensional array) and collection4 (array of list) variables serialize it properly. You can see the result here:
In the cases Odin doesn' show the testArray variable, it’s not stored in the ScriptableObject and the values are lost.
- I’m using Unity 2019.2.9f1 and Odin 2.1.4.
- Editor Only mode is disabled.
- I’m using Windows 10 Pro.
I found a work-around for the issue: I’ll use an array of size 1 of an array of my desired size so Odin will serialize it as a two-dimensional array, but I think it should work the other way too.