diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 445a034adab..efd13dc8b4d 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -613,7 +613,11 @@ void AnimationMixer::_init_root_motion_cache() { } void AnimationMixer::_create_track_num_to_track_cache_for_animation(Ref &p_animation) { - ERR_FAIL_COND(animation_track_num_to_track_cache.has(p_animation)); + if (animation_track_num_to_track_cache.has(p_animation)) { + // In AnimationMixer::_update_caches, it retrieves all animations via AnimationMixer::get_animation_list + // Since multiple AnimationLibraries can share the same Animation, it is possible that the cache is already created. + return; + } LocalVector &track_num_to_track_cache = animation_track_num_to_track_cache.insert_new(p_animation, LocalVector())->value; const Vector &tracks = p_animation->get_tracks();