Serializing the ground generated from a Height Map does not work?


I cannot serialize the mesh of a terrain created with CreateGroundFromHeightMap.
Data is missing from the generated file.
On the other hand it works if I do it with CreateGround. Is there something special that needs to be done for the meshes created with heightMap (because it remains a mesh like with CreateGround.)

Works with CreateGround

Not works with CreateGroundFromHeightMap


Hi, see this fix, line 27

You want to generate a mesh from a PNG file. The PNG file has to be loaded : it’s an asynchronous operation, so the mesh is not ready after yet when the function returns.

There’s a onReady callback invoked once the PNG file has been loaded and the mesh is built, that’s where you can serialize your scene.

1 Like

Thank you so much @SvenFrankson