AssetContainer.instantiateModelsToScene() method does not copy an InstancedMesh.renderOverlay

Hello, it’s me again with a different question. Continuing on in my project I have this Playground where a mesh is added to an AssetContainer.

There are two meshes, a mesh and its instance and both are required to have its renderOverlay = true.

So far, only the mesh but not the instance gets the renderOverlay affected.

I tried cloning, but that didn’t work out with a complex mesh and it’s multiple instances.

Hints anyone?

I appreciate the time for anyone reading this post.

If you apply renderOverlay to the original mesh, it works - https://playground.babylonjs.com/#54UKRQ#4
(line 25, sphere.renderOverlay = true;)
If you apply renderOverlay to the instance, it will not work; instance will only repeat the original mesh overlay settings.

I appreciate your suggestion, @labris, though I should’ve clarified it better.

The steps are to:

  1. Setup the meshes
  2. Add the meshes to an AssetContainer class.
  3. Remove the meshes from the scene by removeAllFromScene()
  4. Instantiate them through instantiateModelsToScene() method or related from the AssetContainer class.
  5. renderOverlay, the meshes and its instances here
  6. Dispose the meshes
  7. just in case, reinstantiate/clone and re-renderOverlay the meshes rerenderOverlay.
  8. Rinse and repeat steps 4 - 7 till the end of the session.

The concept here is like when a mesh would flash red or would get copied or instantiated again and also flash red.

Thanks.

Have a look at https://playground.babylonjs.com/#54UKRQ#6