Search Unity

How to get reference to a specific Animation Clip in Animator.

Discussion in 'Animation' started by DugelStudios, Jan 18, 2016.

  1. DugelStudios

    DugelStudios

    Joined:
    Feb 21, 2015
    Posts:
    92
    For the past 2 hours I have been searching everywhere and I can't find any resources to help me. The documentation is confusing (Especially for Animation) and every information I find is for a previous version of Unity that had a different animation system. Anyway, I have a GameObject with a Animator component attached. The Animator Controller has 4 animation states that it uses. I have a script attached to my GameObject and I can'd find out how to do the following: 1) Get the length any specific clip 2) Change the speed of any specific clip.

    animator.speed = (some number) does not work because it changed the speed of ALL the clips. I want to change the speed of specific clips during runtime. Is there a way I can search the animation clip by name and change the clip speed? Or is there a way I can make a public AnimationClip, drag and drop the clip, and then edit the speed of the clip? And I want to change all of this during runtime, I know I can click on the Animation Clip and change the speed that way. Also, as I listed earlier, I need to get the length of the animation clip. I assume if I can change the speed of an animation clip, I can get the length of the clip because I'd have the reference to it. Any Help?
     
  2. DugelStudios

    DugelStudios

    Joined:
    Feb 21, 2015
    Posts:
    92
  3. ImLife

    ImLife

    Joined:
    Aug 15, 2019
    Posts:
    3
    Thanmks for posting the solved link!
     
    RealSoftGames likes this.