Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Animation Override Controller

Discussion in 'Animation' started by symorian, Aug 1, 2018.

  1. symorian

    symorian

    Joined:
    Jun 7, 2017
    Posts:
    45
    Lately, I've strated to animate my entities with Animation Override Controller instead of assigning each a different Animation Controller.

    What I wonder is, I was able to change the animation speed per state in the Animation Controller.

    How can I achieve this with Override version? Because, the animation states are all same for some entities which is why I switched to animation override controller, yet, I need some of them run their i.e. Idle animation slower than the rest.

    When I click on the controller of the entity, it only shows the "Animation Override Controller" that it is derived from in the Animator window. Not the per-entity one.

    Any help is appreciated.

    Thank you.
     
  2. symorian

    symorian

    Joined:
    Jun 7, 2017
    Posts:
    45
    Just an addition, is adjusting the "samples" amount in the animation window the only way to control the animation speed when using Animation Override Controller which globally controls the animation speeds for several entities?
     
  3. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,571
    Hi,

    you can still control the speed of each state with the orignal controller, if you need to override the speed because the overriding animation is different then you need to expose a controller parameter to do this.

    Create a float parameter on your controller and then select your animator state and check Parameter just below speed and chose the parameter you just created.
    stateparam.png
     
    symorian likes this.
  4. symorian

    symorian

    Joined:
    Jun 7, 2017
    Posts:
    45

    Hi,

    Thank you for this. Actually I've used multiplier parameters for different purposes before but I couldn't just figure it out how to apply it to different type of enemies who use thier own controllers and that belong to Enemy class which has an animation override controller attached to.

    I mean her is my setup,

    Enemy Class (That has Animation Override Controller on it)

    - RoboEnemy (has RoboEnemy overrideController)
    - AxeEnemy (has AxeEnemy overrideController)
    ... etc.

    Now, i.e. I want my roboEnemies to run their idle animations therefore, idle states, at half speed of AxeEnemies. How am I gonna tell my EnemyClass that the current enemy in question is a Robo one and then set the multiplier parameter accordingly via script? I think I'm going to need to add some additional vars and conditionals? Or am I overlooking something?

    Maybe this can be it? ->

    I'll add "animSpeed" parameter in Main Animator Controller and assign it as the multiplier.
    Then, I'll do some assignment in EnemyClass i.e.


    Code (CSharp):
    1.  
    2. [SerializeField]
    3. private float enemyAnimSpeed;
    4.  
    5. EntityAnimator.SetFloat("animSpeed", enemyAnimSpeed);
    6.  
    7.  
    where enemyAnimSpeed is a SerializeField float where I can vary it depending on the type of enemy or even for single instances of each type of enemies?

    Is this an ok solution?
     
    Mecanim-Dev likes this.
  5. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,571
    yeah that sounds good if you can achieve what you want and the solution does bring any new issue
     
    symorian likes this.