Loading of raw UnityEngine.Object not working

Discussion and help for Easy Save 3
Post Reply
dog
Posts: 1
Joined: Thu Jan 19, 2023 8:28 pm

Loading of raw UnityEngine.Object not working

Post by dog »

Seems like variables whose type is UnityEngine.Object (saved by ref) are not deserialized correctly?
Subclasses of UnityEngine.Object work correctly but not the class itself.
Minimal example:

Code: Select all

public class SavedComponentTest : MonoBehaviour
{
    public UnityEngine.Object xx;
}
Looking at the save file, the field is saved correctly (as an ESRef id), but when loading the field is set to null.

Replacing UnityEngine.Object with e.g. Component works fine. This is an OK workaround for my situation since the objects I want to save are all Components, but it does seem like a bug as far as I can tell.

For context, I am trying to save a List<UnityEngine.Object> that represents arguments to a function call (ie, Action) which can be serialized/deserialized via ES3 and then invoked after loading.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Loading of raw UnityEngine.Object not working

Post by Joel »

Hi there,

I don't appear to be able to replicate this at my end. Here's a script I used to try to replicate this:

Code: Select all

using UnityEngine;
using System.Collections.Generic;

public class UnityObjectType : MonoBehaviour
{
    public List<UnityEngine.Object> objs; // Assign to this in the Editor

    void Start()
    {
        if(!ES3.KeyExists("this"))
            ES3.Save("this", this);
        else
            ES3.LoadInto("this", this);
        
        foreach(var obj in objs)
            Debug.Log(obj);
    }
}
Firstly I recommend checking that you're on the latest version of Easy Save, and that the objects you're saving are in the reference manager or are a dependency of your scene.

If this isn't the issue please could you create a script which I can drop into a new scene of a new project which replicates your issue and send it to me with instructions so I can see what is happening.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply