Reference with ID could not be found

Discussion and help for Easy Save 3
Post Reply
ckannon
Posts: 7
Joined: Mon May 04, 2020 5:04 pm

Reference with ID could not be found

Post by ckannon »

Hi all,

I've just started using EasySave and I've created a quicksave function that basically iterates all 'Saveable' gameobjects in my scene and then calls ES3.Save on each one. This works like a treat, and I can then quicksave and quickload repeatedly with no trouble.

However, if I exit the running game and start the game again, then hit quickload (which just iterates all the keys in the file and triggers a load for each one) I get a bunch of the following warnings.

Reference with ID 2324430673537579804 could not be found in Easy Save's reference manager. Try pressing the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager in your scene.
To disable warnings from Easy Save, go to Window > Easy Save 3 > Settings, and uncheck 'Log Warnings'

Any ideas what these mean? Am I doing something wrong?

Thanks,
Chris
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: Reference with ID could not be found

Post by Joel »

Hi Chris,

Could you try updating to 3.3.0 (which was released on the Asset Store today) and see if that resolves the issue?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ckannon
Posts: 7
Joined: Mon May 04, 2020 5:04 pm

Re: Reference with ID could not be found

Post by ckannon »

Hey Joel,

Still a problem in 3.3.0

Did a little further digging and it looks like the references that are missing are for all the the Mesh related properties of the objects. For example sharedMesh or meshRenderer.

These are stock gameobjects that are instantiated into my scene via prefabs. The only custom script on them is my 'Saveable' component which gives them a unique identifier that I later use to load them back in. Here's a quick example of my load code.

Code: Select all

    public void LoadScene()
    {
        _savedPrefabManager.DestroyAll();
        ES3.LoadInto("prefabManager", _savedPrefabManager);
        var keys = ES3.GetKeys();
        foreach (var key in keys.Where(k => !restrictedKeys.Contains(k)))
        {
            if (_savedPrefabManager.HasInstanceID(key))
                InstanceAndLoad(key);
        }
}

Code: Select all

    private void InstanceAndLoad(string key)
    {
        var instanceInfo = _savedPrefabManager.GetInstanceInfo(key);
        var instance = _savedPrefabManager.Instance(key, instanceInfo.prefabType);
        Debug.Log($"Loading {key} into object {instance.name} with ID {instance.GetInstanceID()}");
        ES3.LoadInto(key, instance);
    }
Hope the above makes sense.

Thanks,
Chris
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: Reference with ID could not be found

Post by Joel »

Hi Chris,

Just to check, have you right-clicked your prefabs and pressed Easy Save 3 > Enable prefab for Easy Save, as described in the Saving and Loading Prefab Instances guide?
https://docs.moodkie.com/easy-save-3/es ... 0instances

Also is there a reference to your prefab in the scene? If not, you will need to right-click the prefab and press 'Add Reference to Manager'.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ckannon
Posts: 7
Joined: Mon May 04, 2020 5:04 pm

Re: Reference with ID could not be found

Post by ckannon »

Strike through this....
That looks to have worked. Thanks Joel!

Any way I can add references the references to the EasySave to prefabs in code? I'd like to integrate it into my PrefabManager which already holds references to all of my Prefabs (and handles instancing and reference counting anyway).
Not quite. It seems that even though I'm calling ES3.LoadInto, it's creating a duplicate of my instance, instead of just using the instance I pre-created and provided to the LoadInto method.. I need to do more digging now to see why that is. Also, it seems the warnings are still there, although less of them for each prefab instance (just one for renderer and meshfilter now, none of the others).
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: Reference with ID could not be found

Post by Joel »

Hi there,

This is expected behaviour, because the GameObject you create (and it's Components) will not have the same reference IDs as the GameObject you're loading.

If you want to instantiate the prefab yourself, rather than having Easy Save instantiate it, you will need to save the GameObject's Components, rather than the entire GameObject, and then use LoadInto to load the data back into the Components on the prefab you've instantiated.

Also if you're able to private message me a basic project which replicates the warnings, I'm happy to look into what's causing them. Note that in some situations it's normal for the warnings to be thrown.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ckannon
Posts: 7
Joined: Mon May 04, 2020 5:04 pm

Re: Reference with ID could not be found

Post by ckannon »

Joel,

Perfect! I wired my prefab manager to just let EasySave instance my prefabs for me, and the duplication (and the warnings) went away.

Awesome.

Thanks a lot!

Chris
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: Reference with ID could not be found

Post by Joel »

That's great to hear Chris! Let me know if you run into any other issues :)

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