Search Issue Tracker
Duplicate
Votes
0
Found in
2020.2.0a17
Issue ID
1265108
Regression
No
Reordering elements of a list with [SerializeReference] in the UI swaps data but not type
Context:
I have a script that contains a list of serializable classes following this structure:
[Serializable]
class Test
{
public string name;
public Test()
{
name = "Test";
}
}
[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 Object sameName;
public Test2()
{
different2 = R.integer.ToString();
name = "Test 2";
}
}
When the class type Test 1 and Test 2 are created, their name is set to "Test 1" and "Test 2" respectively, also note that the class Test1 has a property "different1" and Test2 has "different2". This means that it is impossible in the UI to have for example Test1 with the property "different 2" and vice versa.
Repro steps:
- Open the repo project
- Open the SampleScene scene
- Select the "List" GameObject, the list should be empty
- Enter in play mode, this will fill the list with random values
- Reorder some element in the list and look at the property name "Different 1" and "Different 2"
- Observe that all the data is moved correctly except the properties Different 1 and Different 2.
What I think is happening:
I think the data of the object is swapped but not its type which explains why the "different 1" and "different 2" properties can't be re-ordered but the rest of the values are re-ordered when we move an element from place x to y.
Alternatively, you can put the script TestList.cs in an already existing unity project to repro
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
Add comment