Best Practices for Saving, Uploading, Downloading and Loading 3D Models with ES3 and Firebase Storage

Discussion and help for Easy Save 3
Post Reply
Mghobrial
Posts: 1
Joined: Thu May 11, 2023 4:50 pm

Best Practices for Saving, Uploading, Downloading and Loading 3D Models with ES3 and Firebase Storage

Post by Mghobrial »

Hello,

I'm currently working on a Unity project where I'm trying to save 3D models using ES3, upload them to Firebase Storage, download them and then load them into my scene. I'm using Firebase to store these 3D models as ES3 files, and ES3 to save and load these models in Unity.

However, I'm having some issues with this approach. The saved ES3 file seems to only contain metadata like the names and materials of the objects, but not the actual mesh data. The file is also very light (around 22kb), which makes me suspect that the mesh data isn't being saved.

Here's a simplified version of the code I'm using:
// Saving a GameObject with ES3
public static void SaveGameObject(GameObject gameObject, string key)
{
ES3.Save<GameObject>(key, gameObject);
}

// Loading a GameObject with ES3
public static GameObject LoadGameObject(string key)
{
if (ES3.KeyExists(key))
{
return ES3.Load<GameObject>(key);
}
else
{
Debug.LogError("No data found for key: " + key);
return null;
}
}

In my current approach, I'm calling SaveGameObject() to save my 3D model as an ES3 file, uploading this file to Firebase Storage, downloading it later, and then trying to load it into my scene with LoadGameObject().

I wanted to ask if there are any best practices or recommended approaches for saving, uploading, downloading and loading 3D models with ES3 and Firebase Storage. Are there any things I should consider or be aware of to ensure that the mesh data is saved and loaded correctly?

Any help or advice would be greatly appreciated.

Thank you.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Best Practices for Saving, Uploading, Downloading and Loading 3D Models with ES3 and Firebase Storage

Post by Joel »

Hi there,

Fields of objects will be saved by reference, not by value. If you want to save a Mesh or Material by value you would need to save it directly. I.e. using an ES3.Save call which saves that Mesh/Material, not the GameObject which references that Mesh.

Alternatively you could try going to Tools > Easy Save 3 > Settings > Advanced Settings and change Serialise Unity Object fields to By Value. However, this will save the entire serialisation tree of the GameObject by value, which can be quite intensive, so should be used sparingly.

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