Serialiazation polymorphism error on the List

Issue #89 resolved
Anzar Fauzi created an issue

When I Click the add button an error occurs like in the picture. I just following the tutorial in serialize anything


And when I click or access as I circled on the image, an error occurs too.

error3.png erorr2.png

my unity version : 5.6.1

Comments (2)

  1. Bjarke Elias

    Hi Anzar,

    Regarding the "Add Animal" button: The Animal list is being serialized by Odin, this means that it now has support for null values, which is something that is otherwise not the case. So you need to need to instantiate the list before adding values to it. You can do that by simply clicking on the object field for the list:


    if you want to create an instance of a list automatically when adding the Test component, then you only need to specify this in the code:

    public List<Animal>  animals = new List<Animal>();

    The problem you are having with the dictionary is solved in the next patch which we are just waiting for Unity to approve.

  2. Log in to comment