Cannot set property material of [object Object] which has only a getter

I use AssetContainer.instantiateModelsToScene() clone the model.I need to clone the material.An error was throw.

https://playground.babylonjs.com/#QHKHQE#1

It crashes because it tries to set the material on an instanced mesh, which is not possible as an instanced mesh inherits the material from its master mesh (there’s no setter for material in the InstancedMesh class).

Will be fixed by:

does the same concept apply to skeletons too? I am trying to create an asset pool and am getting the same error only difference that it cannot get skeletons

This PR should fix the problem for skeletons:

1 Like

Thanks. Will check it out

Hi this worked but the animations don’t seem to be working? Is that a problem with babylon or am I doing something wrong. The animation group length is 0 in game but looks fine in sandbox

You should create another issue (with a repro PG if possible) as this is another problem.

2 Likes