Hi,
I have created two texts using advanced texture.
https://playground.babylonjs.com/#TMHF80#1052
I am saving the scene as babylon file.
But when I open the saved Babylon file in sandbox, the sandbox’s output is not matching with PG sample’s output.
PG
sandbox
Thanks
Gopinath Vellingiri
@msDestiny14 is our GUI expert and might have a look shortly
Wow. Great find!.
I did a check and downloaded the entire scene as a HTML and got no issues, woo! So looks like we got a boo boo somewhere in the Babylon file serialization. I’ll get to the bottom of it and let you know!
3 Likes
Hi! Thank you for reporting this issue Apologies for taking so long to investigate. Unfortunately we lost track of it with the holidays upon us. However, we have found the cause of the issue and we have a fix for you.
The root of the problem is that the serializer does not work well when objects in the scene share the same name. Object IDs are based off of names, so the loader can get confused about which object you’re pointing to. This can lead to incorrect material or texture assignment. A quick and dirty fix is to change two things:
- Make the names (and thus the IDs) of the meshes (the planes) distinct
- Make the IDs of the materials distinct. Changing the names isn’t enough, because the ID is generated upon creation. Unfortunately, the way that AdvancedDynamicTexture.CreateForMesh works at the moment, it will always create a material with a hard-coded name, inevitably leading to a collision if you call it more than once. But you can manually change the ID yourself.
I’ve made both changes in the PG here:
Size Plane Based on Dynamic Texture | Babylon.js Playground (babylonjs.com)
This can now export a correct .babylon file
We are going to go in and fix these issues in the codebase, but in the meantime, this should solve your issue. Please let us know if you have more questions, and again, sorry for the late reply!
5 Likes