Scene Serialization cannot save material and animation

I serialize a simple scene into babylon file:https://playground.babylonjs.com/#1AGCWP#37
However, when I reload it in sandbox, animation and material disappear:

That it because you serialize the scene before the materials are ready.

There are many ways of doing that, depending on your usecase. Here is the one approach that is not recommended - using setTimeout :slight_smile:

Scene Serialization | Babylon.js Playground (babylonjs.com)

What a quick reply!! :laughing:
Babylon is the BEST community, EVER. Too much love. :sparkling_heart:

After using setTimeout , I still get the same result in sandbox: https://playground.babylonjs.com/#1AGCWP#39

2 Likes

Sorry, missed the fact that you are trying to load it in the sandbox.

You will need to provide the images as well when dragging the file to the sandbox. Drag and drop both the .babylon file and all of the image assets into the sandbox and it will work.

Thx Raanan! It works if I drop image into sandbox.
But I am wondering if we can encode everything into babylon file?

Oh, you can force serializing the textures (lines 14 and 15)

Scene Serialization Timeout | Babylon.js Playground (babylonjs.com)

2 Likes