I am encountering a NullReferenceException when attempting to inspect a derived class that includes a private array or list field from its base class in the Inspector. This issue occurs under specific circumstances described below.
Define a serializable base class with a private array or list field.
Create a serializable derived class that inherits from this base class.
Attempt to inspect a component with a field of the derived class in the Inspector.
Sample Code
using UnityEngine;
namespace Alchemy.Samples
{
public class InheritSample : MonoBehaviour
{
public DerivedClass derivedClass;
[System.Serializable]
public class BaseClass
{
[SerializeField]
private float[] privateArray;
}
[System.Serializable]
public class DerivedClass : BaseClass
{
}
}
}
Issue Description
I am encountering a NullReferenceException when attempting to inspect a derived class that includes a private array or list field from its base class in the Inspector. This issue occurs under specific circumstances described below.
Exception
Steps to Reproduce
Sample Code