Skip to content

Nested Lists of Lists of Lists are leading to NullReferenceException when pressing "+" in the Inspector #87

@max-critcrew

Description

@max-critcrew

Hey,

first of all - we love Alchemy and this is our first issue we're encountering. So we wanted to report it, to see if anyone has a fix already.

Unity Version: 2022.3.17f1
Alchemy Version: 2.0.1

Example reproduction code file:

using System.Collections;
using System.Collections.Generic;
using Alchemy.Inspector;
using UnityEngine;

[Serializable]
public class ContainerClass
{
    [SerializeField] public List<int> listOfInt = new List<int>();

}

[Serializable]
public class SecondContainerClass
{
    [SerializeField] public List<ContainerClass> listOfContainerClass = new List<ContainerClass>();

}


public class MyTest : MonoBehaviour
{
    [SerializeField] public List<SecondContainerClass> listOfListOfList = new List<SecondContainerClass>();

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
}

Simply add this to any GameObject and press plus in the nested lists:

image

Error in screenshot:
image

Error as text:

NullReferenceException: Object reference not set to an instance of an object
Alchemy.Editor.Elements.PropertyListView+<>c__DisplayClass0_2.<.ctor>b__2 (UnityEditor.SerializedProperty x) (at ./Library/PackageCache/com.annulusgames.alchemy@b03898d42a/Editor/Elements/PropertyListView.cs:32)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation+<>c__DisplayClass7_0.<TrackPropertyValue>b__0 (System.Object e, UnityEditor.SerializedProperty p) (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/BindingExtensions.cs:1010)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.UpdateTrackedProperties () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/BindingExtensions.cs:844)
UnityEditor.RetainedMode:UpdateSchedulers() (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/RetainedMode.cs:55)

Thanks for your time looking at this and if you got any input or ideas, let us know :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions