TylerTemp / SaintsField

A Unity Inspector extension tool focusing on script fields inspector enhancement
MIT License
148 stars 9 forks source link

Errors when removing elements in arrays with `[SerializeReference, ReferencePicker]` #34

Closed braide closed 2 months ago

braide commented 2 months ago

I keep getting exceptions from SaintsField when I'm working with arrays that has [SerializeReference, ReferencePicker] attributes , specifically removing elements. I need to deselect and reselect the object I'm working with to refresh the inspector all the time.

Try adding this script and add some elements to the arrays then remove some, I get errors very frequently.


public class Test : MonoBehaviour
{
    [SerializeReference, ReferencePicker] public TestData[] TestData;
}

[Serializable]
public class TestData
{
    [SerializeReference, ReferencePicker] public InternalTestData[] InternalTestData;
    [MinMaxSlider(0, 100)] public Vector2 TestMinMax = new Vector2(0, 2);
}

[Serializable]
public class InternalTestData
{
    [MinMaxSlider(0, 100)] public Vector2 InternalTestMinMax = new Vector2(0, 2);
}
braide commented 2 months ago

Having the [SerializeReference, ReferencePicker] array in a [Expandable] scriptable object seems to make it even worse

TylerTemp commented 2 months ago

Hi @braide

Please check if it's been fixed in 3.0.13

braide commented 2 months ago

Hi @TylerTemp

Seems to be fixed yeah 👍