Search Unity

prefab variant lost data if it contains an component which has ISerializationCallback

Discussion in 'Prefabs' started by FancyZero, Jan 29, 2019.

  1. FancyZero

    FancyZero

    Joined:
    Apr 30, 2018
    Posts:
    3
    I have a component with Dictionary<>. since it is not serializable by default, I implement the ISerializationCallbackReciver to save it as keys[] and values[], it works fine until I create a prefab variant from that prefab, the dictionary in the variant is empty, even I "revert" the variant, it looks ok in the inspector , but after you select other object and reopen the variant , the dictionary still empty
     
  2. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    @FancyZero

    Can you please file a bug report with a small example project so we can reproduce the issue and have a look at it.
     
  3. FancyZero

    FancyZero

    Joined:
    Apr 30, 2018
    Posts:
    3
    here is the project
    I just copy the code from ISerializeCallbackReceiver demo on unity manual & documentation page
    you can see the gameobject variant lost all data here, even you revert it, it still lost everything after you switch to other object and back
    I have been tested with 2018.3.0 , 3.2 3.3 only 3.0 works fine

    here is the video, it's very obvious
     

    Attached Files:

  4. FancyZero

    FancyZero

    Joined:
    Apr 30, 2018
    Posts:
    3
    Last edited: Feb 3, 2019