From 482ab29f4973c1c45fa9a0f0d5d08585d485df2f Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 18 Oct 2023 10:40:56 +0800 Subject: [PATCH] iterate over completed animations in reverse order --- ios/src/AssetManager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ios/src/AssetManager.cpp b/ios/src/AssetManager.cpp index 5f6ad060..0825fb63 100644 --- a/ios/src/AssetManager.cpp +++ b/ios/src/AssetManager.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -262,7 +263,7 @@ void AssetManager::updateAnimations() { for (auto& asset : _assets) { - vector completed; + std::vector completed; int index = 0; for(auto& anim : asset.mAnimations) { @@ -333,8 +334,9 @@ void AssetManager::updateAnimations() { asset.mAnimator->updateBoneMatrices(); index++; } - for(auto& it : completed) { - asset.mAnimations.erase(asset.mAnimations.begin() + it); + + for(int i = completed.size() - 1; i >= 0; i--) { + asset.mAnimations.erase(asset.mAnimations.begin() + i); } } }