Search Issue Tracker

Duplicate

Votes

0

Found in

2020.2.0a17

Issue ID

1265104

Regression

No

Crash in ApplyModifiedPropertiesWithoutUndo after reordering elements or duplicating an element in a list from the UI.

Quality of Life

-

Repro steps:
- Open the repro project
- Open the SampleScene scene
- Select the "List" gameobject in the hierarchy (the list should be empty)
- Enter play mode, this will fill the list with random values
- Try to move the second element of the reorderable list in the first position.
- Observe a crash

Additionally the same crash happens if you try to duplicate one of the elements in the list.

Alternatively, you can copy/paste this script and try to reorder a component in the list in an already existing project:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Random = System.Random;
using Object = UnityEngine.Object;

static class R { static Random r = new Random(); public static int integer => r.Next(); }

[Serializable]
class Test
{
public string name;
public string commonProperty1;

public Test()
{
name = "Test";
commonProperty1 = R.integer.ToString();
}
}

[Serializable]
class Test1 : Test
{
public string different1;
public Object sameName;

public Test1()
{
different1 = R.integer.ToString();
name = "Test 1";
}
}

[Serializable]
class Test2 : Test
{
public string different2;
public int sameName;

public Test2()
{
different2 = R.integer.ToString();
name = "Test 2";
sameName =R.integer;
}
}

class TestList : MonoBehaviour
{
[SerializeReference]
public List<Test> tests = new List<Test>();

void Start()
{
tests.Add(new Test2());
tests.Add(new Test1());
tests.Add(new Test2());
tests.Add(new Test1());
}
}

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.