Page 1 of 2

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

Posted: Wed Sep 30, 2020 7:03 pm
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

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

Posted: Wed Sep 30, 2020 8:21 pm
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

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

Posted: Thu Oct 01, 2020 4:12 am
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

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

Posted: Thu Oct 01, 2020 6:27 am
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

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

Posted: Thu Oct 01, 2020 8:29 am
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

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

Posted: Thu Oct 01, 2020 9:02 am
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

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

Posted: Thu Oct 01, 2020 10:54 am
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

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

Posted: Thu Oct 01, 2020 4:04 pm
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

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

Posted: Thu Oct 01, 2020 6:52 pm
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

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

Posted: Fri Oct 02, 2020 7:46 am
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