Editor Window, cannot add or remove on nested array.

9002506--1240405--upload_2023-5-10_1-18-22.png
I have problem with nested array where I cannot add or remove it on editor window.

This is Card Resources class derived from Resources class

public class CardResources : BaseResources<GameObject>
{

}

This is Base Resources class

[System.Serializable]
public class NamedResource<T> where T : Object
{
    public string Path;
    public T[] Resources;
}

public abstract class BaseResources : ScriptableObject
{

}

public abstract class BaseResources<TObject> : BaseResources where TObject : Object
{
    [SerializeField] private NamedResource<TObject>[] _resources;

    public NamedResource<TObject>[] Resources { get => _resources; }
}

This is Resources editor window

public class CardResourecesEditor : ResourcesEditor
{

    [MenuItem("Resources/Cards")]
    protected static void OpenWindow()
    {
        var window = GetWindow<CardResourecesEditor>();
        window.Show();
        window.Init<CardResources>();
    }
}

public class ResourcesEditor : EditorWindow
{
    protected SerializedObject serializedObject;
    protected SerializedProperty serializedProperty;
    private BaseResources resources;
    protected string selectedPropertyPach;
    protected string selectedProperty;


    protected virtual void Init<T>() where T : BaseResources
    {
        resources = GetInstances<T>();

    }

    protected virtual void OnGUI()
    {
        if (resources == null)
            return;
        serializedObject = new SerializedObject(resources);
        SerializedProperty stringsProperty = serializedObject.FindProperty("_resources");
        serializedObject.Update();

        EditorGUILayout.PropertyField(stringsProperty, true);
        Apply();
    }


    public static T GetInstances<T>() where T : BaseResources
    {
        string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name);
        T[] a = new T[guids.Length];
        for (int i = 0; i < guids.Length; i++)
        {
            string path = AssetDatabase.GUIDToAssetPath(guids[i]);
            a[i] = AssetDatabase.LoadAssetAtPath<T>(path);
        }

        return a[0];

    }


    protected void Apply()
    {
        serializedObject.ApplyModifiedProperties();
    }
}

Seem like downgrade to 2020.3.43f1 is working. But on 2021.3.15f / 2021.3.21f not working.

Anyone please help? Even with this simple test, the button + and - not working on children

[System.Serializable]
public class Test
{
    public List<GameObject> children;
}
public class SimpleTest : ScriptableObject
{
    public List<Test> listChildren;
}

Bump

Fixed by switch to UI Toolkit

same problem,May I ask how you resolved it later on?

Hi, too bad, there is no fix for UGUI. I believe it’s by design.
So for workaround, I write my custom editor window in Visual Element. It was hard first time, but I’m getting used to it then I started to think it was easy to make, less code, and lightweight.