Crash when removing/adding element in nested serialized list of prefab instance

Issue #8 resolved
Ivan Wang created an issue

Unity v5.5.0f3 is crashing when removing or adding an element in a nested list on a prefab instance.

Steps to Repro

Define the following classes:

public abstract class BaseEvent {}
public class MessageEvent : BaseEvent {
    public string[] messages;
}
public class EventManager : SerializedMonoBehaviour {
    [OdinSerialize]
    private List<BaseEvent> events;
}
  1. Create an empty GameObject with an EventManager. Add a MessageEvent to the events list and a single string to the messages array.
  2. Save the GameObject as a prefab.
  3. Select the original GameObject instance (not the prefab).
  4. Delete the inner message (or click the plus to add a new element to the array).
  5. Observe crash.
  6. (Possibly relevant side effect:) Upon reopening Unity, the GameObject is no longer an instance of the prefab.

Comments (3)

  1. Tor Esa Vestergaard
    • changed status to open

    Thank you for the report! We've reproduced this issue and are investigating it promptly.

  2. Tor Esa Vestergaard

    We've found the bug and fixed it in the next patch (0.9.0.2), which should hopefully be distributed sometime today.

    Edit: Meanwhile, you can use a List<string> to contain your messages, as the error was related to prefab modifications that changed the length of an array.

  3. Log in to comment