using UnityEngine; namespace TriLibCore.Mappers { /// Represents a Mapper used to fill Animator Override Animation Clips. public class AnimatorOverrideAnimationClipMapper : AnimationClipMapper { /// /// Animator controller override to use on the animator. /// public AnimatorOverrideController AnimatorOverrideController; /// public override AnimationClip[] MapArray(AssetLoaderContext assetLoaderContext, AnimationClip[] sourceAnimationClips) { var animator = assetLoaderContext.RootGameObject.GetComponent(); if (animator == null || AnimatorOverrideController == null) { if (assetLoaderContext.Options.ShowLoadingWarnings) { Debug.LogWarning("Tried to execute an AnimatorOverrideController Mapper on a GameObject without an Animator or without setting an AnimatorOverrideController."); } return sourceAnimationClips; } animator.runtimeAnimatorController = AnimatorOverrideController; return sourceAnimationClips; } } }