浏览代码

Fix array iterator when disposing an item

noalak 5 年之前
父节点
当前提交
782fe74dff
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/Loading/sceneLoader.ts

+ 2 - 2
src/Loading/sceneLoader.ts

@@ -1063,7 +1063,7 @@ export class SceneLoader {
         });
 
         // Copy animation groups
-        animationAssetContainer.animationGroups.forEach(animationGroupInAC => {
+        animationAssetContainer.animationGroups.slice().forEach(animationGroupInAC => {
             // Dispose animation groups with same name as one being loaded
             scene.animationGroups.forEach(animationGroup => {
                 if (animationGroup.name == animationGroupInAC.name) {
@@ -1081,7 +1081,7 @@ export class SceneLoader {
         });
 
         // Copy animatables
-        scene.animatables.forEach(animatable => {
+        scene.animatables.slice().forEach(animatable => {
             let target = _targetConverter(animatable.target);
 
             // If the animatable has just been loaded