Unable to load a scene

Hi everyone,

I have saved a scene and i want now to load it back but there is an issue.

Here’s a PG that reproduces the issue

and the error :

If anyone can help me…

Thanks in advance,


There are some materials that are not initialized correctly. What scene did you use to generate this .babylon file? were there special type of materials (like maybe shader materials or custom materials)? Would be great to debug this correctly :slight_smile:

No, I don’t think so. I only use StandardMaterial, PBRMaterial, PBRMetallicRoughnessMaterial and a SkyMaterial.

How can I “give” you the scene ? I only have a babylon file. Is this what you want ?

how did you create this .babylon file?

I’m making a configurator so i have many classes and codes to create a project that I save in a babylon file.

I want to load a saved project.

I’ve changed my PG to give you a simple example. It does not work, even with an “empty project”.

and the .babylon file

_temp_projetsave (4).zip (91.7 KB)

Thanks for your help

I have a feeling you understood that I said you are doing something wrong. I didn’t. I am saying that 2 (or maybe more?) materials are not being serialized from the original scene. If you want to show us how you generate this .babylon file, we will be able to check what happened, what is not being serialized correctly and how we can fix it.
The playground (which is the same as before, i think?) doesn’t help, because you are only showing the serialized data, but not how the data was serialized.

BTW - Looking at the serialized data - you are using a shader material. linesShader was serialized using the shader material without the shader. I believe we don’t support that when serializing a .babylon file. is it possible to generate this material after the scene was loaded?

I’m sorry but i don’t understand how I can “show you” how I generate this .babylon file. I use the classic functions

var serializedScene = BABYLON.SceneSerializer.Serialize(scene)
var strScene = JSON.stringify(serializedScene);

Do you want all the code i use to save the scene ? Tell me…

I’m not able to show you all the code i use to generate my scenes, there are too many connected classes to make a playground. So I tried to find when it does not work any more.

here’s the PG and the 2 files, one is “working”, the other is not.

tests_babylon.zip (145.4 KB)

Thanks anyway for your help, it is precious to me, I have been looking looking at the bug since sunday.


That would be helpful, yeah. But it would also be helpful if you could reproduce this on the playground with a minimal reproduction. As far as I can see - you are using a custom shader, but it seems like it is part of the lines mesh that you are probably using in your scene. Is serialization working well when you are not using the lines meshes?

Yes, When I include the axes (the line meshes), it does not work anymore. But i’ve made a PG with the axes only and it works.

So you’re right, it must be something about the lines but i don’t know what yet…

hurrah !!!

You gave a clue to me when telling me about lines. I “disposed” a material before saving my project.

Thank you very much for your help…

1 Like