ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Discussion and help for Easy Save 3
rktumuluri
Posts: 7
Joined: Wed Sep 30, 2020 3:24 pm

ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by rktumuluri »

I have a small Unity App. I add glTF models at runtime. I save it using EasySave3. I can see the file being saved correctly. (json format). I used a basic method

ES3.Save(goKey, gameObject, filePath);

On load I used the corresponding basic method
foreach(var key in ES3.GetKeys(filePath)) {
ES3.Load(key, filePath);
}

It works correctly for static gameobjects. But new objects brought in via a glTF importer fail to rendered when I quit the App and re-open. Although, I do see a reference in the "hierarchy" panel of UnityEditor.

I get the following warning message.


Reference for UnityEngine.Material with ID 4156368712344747260 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. If you are loading objects dynamically, this warning is expected and can be ignored.
To disable warnings from Easy Save, go to Window > Easy Save 3 > Settings, and uncheck 'Log Warnings'


I understand that the "reference manager" has somehow not persisted to file the "reference id's" of the newly added object.

Any advice on how to solve it.


Joel, I can send you a test-case for this. It is very small and clean.

Regards
/rk
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by Joel »

Hi there,

This is because the models are being loaded at runtime, which means that when you reload the scene the reference to your object will no longer exist.

In this case you would need to save the Material which is being created at runtime separately before loading the GameObject it's applied to to ensure it's saved by value rather than by reference.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
rktumuluri
Posts: 7
Joined: Wed Sep 30, 2020 3:24 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by rktumuluri »

Joel,

Thx for your prompt response. I experimented with Runtime Settings "Serialise Unity Object Fields" by "Value" and "By Ref And Value". No luck. Pls see attached image.

I could not find how to set these via ES3Settings class either.

The test-case (clean, small) for this is at
[LINK DELETED]

Could you look into this and advice pls ?.

I have spent a LOT of time trying to fix this. I am clearly missing something.

Regards
/rk
Attachments
EasySave3_Serialize_Value_And_Reference.png
EasySave3_Serialize_Value_And_Reference.png (152.95 KiB) Viewed 2291 times
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by Joel »

Hi there,

Apologies, perhaps I wasn't clear in my response. You need to save the Material (and Texture if this is loaded at runtime) separately. I.e. use ES3.Save and ES3.Load to save and load them.

Also I've edited your post to remove the link. In the future could you please only share projects via private message, otherwise anyone can download your project and have access to the Easy Save package, which is against Unity's license agreement.

Thanks,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
rktumuluri
Posts: 7
Joined: Wed Sep 30, 2020 3:24 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by rktumuluri »

Joel,

Once again thanks for your prompt response. EasySave's warnings are not only for "material" but for "mesh" as well.

Reference for UnityEngine.Mesh with ID 796278843440852641 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. If you are loading objects dynamically, this warning is expected and can be ignored.
To disable warnings from Easy Save, go to Window > Easy Save 3 > Settings, and uncheck 'Log Warnings'

Hope u have downloaded the "test-case" I sent. Request you to suggest the right solution in that test case please. ES3.Save is working correctly. I can see the newly-added object in the saved file. ES3.Load is failing partially. The gameObject is getting loaded as evident in the "hierarchy" but it is not showing up in the Scene. (play mode of course).

Regards
/rk
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by Joel »

Hi there,

If it is being thrown for Mesh then you would also need to save that.

Alternatively if you're providing the importer with a path or identifier to load these Meshes (etc), you could simply save that and then apply the Mesh/Materials/etc to the loaded object yourself.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
rktumuluri
Posts: 7
Joined: Wed Sep 30, 2020 3:24 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by rktumuluri »

Joel,

This is puzzling. For all gameObjects ES3.Save() is working. This includes the newly added models. It is evident in the saved file.

On loading (ES3.Load() ) the "added models" show up in the hier-archy window but are not rendered and a warning msg is sent out.

If there is a way to save (i.e perisist) the "Reference-ids" and related info that "ES3 Reference Mgr" saves, it might solve the problem.

In any case, I request you to at least try-out the test-case I shared. It is a small / clean test-case.


Regards
/rk
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by Joel »

Hi there,

When I click the link it tells me that the "File's in owners trash" and doesn't allow me to download it. Please could you private message me an active link with instructions.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
rktumuluri
Posts: 7
Joined: Wed Sep 30, 2020 3:24 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by rktumuluri »

Joel,

Sent you a private msg with "link" to download and "instructions" to re-create the bug.

Once again thanks for your support.

Regards
/rk
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3 Reference Mgr ... Reference Id's not persisted ... Unclear operation ...

Post by Joel »

Thanks for sending that over.

I don't appear to be able to see anywhere in your scene where you're saving the Material or Mesh separately, so I'm not sure if you've sent me the wrong project?

What would be more efficient for your project however is to simply save the path of the GLTF file you're loading, and it's position. Then when you load, you simply import that GLTF file and move it to the required position. This would mean you wouldn't need to save the entire GLTF by value.

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