Array2DEditor icon indicating copy to clipboard operation
Array2DEditor copied to clipboard

Serializable class

Open chebedzic opened this issue 1 year ago • 1 comments

Hey there,

Amazing plugin and I'm really happy with it.

I've managed to create an Array 2d of custom scriptable object classes, but I have a problem if I try to create Array2d of a serializable class.

Basically is this possible?



[Serializable]
public class Array2DTest : Array2D<Test>

[Serializable]
public class Test

[CustomPropertyDrawer(typeof(Array2DTest))]
    public class Array2DTestDrawer : Array2DDrawer
    {
        protected override object GetDefaultCellValue() => new Test();

        protected override object GetCellValue(SerializedProperty cell) => cell.managedReferenceValue;
        protected override void SetValue(SerializedProperty cell, object obj)
        {
            cell.managedReferenceValue = (Test) obj;
        }
    }

chebedzic avatar Jun 14 '23 15:06 chebedzic