jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

Editor loses reference to BaseBehaviour derived object #148

Open diccon01 opened 8 years ago

diccon01 commented 8 years ago

I have the following classes:

public class Item : FullInspector.BaseBehavior
{ 
    public float size;
    public float weight;
    ...
}

public class PlayerAction : BaseObject
{
    public virtual void DoAction(Player p) {}
...
}

public class PlayerInventoryAction : PlayerAction
{
   public enum InventoryAction
    {
        Add,
        Remove
    }

    public InventoryAction action;
    public Item item;
    public int count;

    public override void DoAction(Player p)
    {}
    ...
}

public class Quest : BaseObject
{
  public System.Collections.Generic.List<PlayerAction> OnCompleteActions;
}

My issue is that when I populate the OnCompleteActions list in the editor, the second member of the list fails to store its Item reference. I have a variety of different Item objects and it does not seem to matter which I use. For some reason the first member of the list seems to serialize correcty. Can you help with this?

diccon01 commented 8 years ago

Update to this, I tried deleting the list and starting again, and this time the Item references are saving correctly, but the count member of the second list entry always saves as zero. It all seems a bit flaky...

diccon01 commented 8 years ago

Further update, I checked the serialized scene file, and the count value is correctly stored, however in the editor it always appears as zero.

jacobdufault commented 8 years ago

Are you using a build from Access? I recall fixing some serializing issues with BaseObject references.