修复clip内存泄漏

This commit is contained in:
李砚
2024-10-11 11:50:30 +08:00
parent 16f51774d5
commit 07bd34dad8

View File

@@ -40,9 +40,12 @@ export class AnimationClipUtils {
let sample = data.sample ? data.sample : 8;
let wrapMode = data.wrapMode ? data.wrapMode : AnimationClip.WrapMode.Normal;
let idx = animation.clips.findIndex((clip)=>{ return clip.name == data.name});
if (idx >= 0)
let idx = animation.clips.findIndex((clip) => { return clip.name == data.name });
if (idx >= 0) {
let clip = animation.clips[idx];
animation.removeClip(animation.clips[idx], force);
clip.destroy();
}
let spriteAtlas = ResLoader.ins().get(data.path, SpriteAtlas, bundle);
if (!spriteAtlas)
spriteAtlas = await ResLoader.ins().loadAsync(bundle, data.path, SpriteAtlas);