AssetContainer.mergeAnimationTo from one scene to another

I have a single glTF mesh/rig that is instantiated multiple times per scene. I also have glTF animation files (using the same rig) that I want to apply to certain instances of the mesh. I’d like to minimize loading. My thinking was that I could use SceneLoader.LoadAssetContainerAsync() to load the clips to a persistent scene that doesn’t get rendered, and then use AssetContainer.mergeAnimationsTo() to apply those animations to my main, rendered scene that gets destroyed and recreated on player death. However, after using mergeAnimationsTo that scene.animationGroups is empty, while persistentScene.animationGroups has the originally loaded anims as expected. I can see the animations applied to the rendered instantiated meshes, I just can’t access or control them (.play(), .stop() etc). I’m new to Babylon - can I not apply data across scenes like this? Does the persistent scene need to be included in the render loop for this to work? Should I just aim to keep the same scene around the whole time instead?

Note that I’ve gotten all the animation retargeting, controls, etc. working while operating on a single scene, so I know there’s not an issue with my mesh, animations, glTF loader etc.

Welcome aboard!

I guess something like this should work, but I’m no expert with asset containers / animations…

I think a simple repro in the Playground (https://playground.babylonjs.com/) would help a lot here.

I started to create a Playground, but this is tricky to repo in that environment given the combination of files (CORS), async, and multiple scenes…

I don’t think CORS is part of the problem here, so you should try to reproduce the problem with a repro as minimal as possible: only one scene, a single mesh (or more if you need more, but keep as low as possible) with one animation. Load the assets in the asset container and try to move/create them in the main scene. If I understand your description, this should fail.