Monobehavior on Prefab Loses it's Original Values When instantiated

Hey guys so I have a game object which has a class that stores a struct that contains several List<Matrix4x4[ ]>.

In edit mode I can initialize the values through code.

As soon as I make it a prefab and instantiate it by dragging it into the scene from the assets folder, the values of the arrays on the monobehavior are null.

My code setup looks like this:

public class Tile {
    public struct TileDetails{
        public List<Matrix4x4[]> grassMatrices;
        public List<Matrix4x4[]> rocksMatrices;
    }

}

Can anyone help me figure out why grassMatrices and rocksMatrices suddenly become null? I need to save this data on the prefab.

Thanks,
Aaron

Initializing your values within the event start() should always work.

Hi,
I think the issue you are encountering is that Unity cannot serialize multidimensional array.

Note: Unity does not support serialization of multilevel types (multidimensional arrays, jagged arrays, and nested container types). If you want to serialize these, you have two options: wrap the nested type in a class or struct, or use serialization callbacks ISerializationCallbackReceiver to perform custom serialization. For more information, see documentation on Custom Serialization.

You can find out more information about serialization rules here: [Unity - Manual: Script serialization](http://You can find out more information about serialization rules here: Unity - Manual: Script serialization)
Regards