Questions about using dispose function to remove skeleton in assetContainer

Hi Team,

I have a problem using LoadAssetContainerAsync to load partial assets to the scene. I want to load a mesh from a glb file which contains a full character, I mean meshes have skin data and transfernodes link to the skeleton. But I only want to load the meshes as the scene already have a same skeleton as the one in glb. What I did is

  1. mesh.skeleton = scene.skeletons[0]
  2. dispose the skeleton.
  3. dispose the transfernodes.
  4. container.addAllToScene()

Finally I found when I dispose the skeleton, the attribute _isDispose was set as True but still was added to the scene.
I wonder if it is a bug or a feature? Is there any efficient way to load partial assets to the scene without disposing anything from a glb file?

PS: I use npm version which is 4.26.

Hey can you repro in the PG because I’m not sure I understand what you are doing :slight_smile:
You are calling skeleton.dispose() so it is expected for the skeleton to have isDispose set to true

Calling mesh.skeleton = scene.skeletons[0] does not make a copy of it
If this is what you want you have to run this:
mesh.skeleton = scene.skeletons[0].clone()

Thank you for your concern. I cannot repro this issue in the PG, it looks fine, but I can still provide this one for explaining what I did. Consider the PG is 5.0.0alpha38, the problem occurred when I use the public version from npm, which is 4.26. So it is safe to use 5.0 version? What I want show is when I am trying to dispose the skeletons in the second assetContainer, the skeletons still there but _isDisposed is set as True, which leads to the scene still have the duplicate skeleton.

Oh yes you can go ahead