Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Can't play animation clip on animatorOverrideController

Discussion in 'Animation' started by unity_2505rohan, May 4, 2023.

  1. unity_2505rohan

    unity_2505rohan

    Joined:
    Sep 22, 2021
    Posts:
    1
    Hey all,

    I'm working on a complex game character that uses procedural animations. As there can be multiple of these characters at the same time I'm using an animationOverrideController that overrides the original animation when the script gets initialized.

    For some odd reason, when I try to play my animationClip using the animationOverrideController, Unity tells returns the message "Animator does not have an AnimationController". I've been wrestling with this for the past few hours but I can't figure it out.

    The following is a code snippet of the code I'm running:
    Code (CSharp):
    1. clipCopy = baseClipWalking;
    2.         clipCopy.name = baseClipWalking.name;
    3.  
    4.         if (veltharAnimator.runtimeAnimatorController != null)
    5.         {
    6.             overrideController = new AnimatorOverrideController(veltharAnimator.runtimeAnimatorController);
    7.             overrideController["walking"] = clipCopy;
    8.             veltharAnimator.runtimeAnimatorController = overrideController;
    9.             Debug.Log(veltharAnimator.runtimeAnimatorController);
    10.             veltharAnimator.Play(clipCopy.name, 0);
    11.         }
    12.         else
    13.         {
    14.             Debug.LogError("No AnimatorController found on " + veltharAnimator.gameObject.name);
    15.         }
    And this is a screenshot of the error message I recieve. upload_2023-5-4_15-32-48.png