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. Dismiss Notice

How to create a static first state for an animation controller?

Discussion in 'Animation' started by HeatWave_Games, Sep 23, 2016.

  1. HeatWave_Games

    HeatWave_Games

    Joined:
    Jun 3, 2016
    Posts:
    52
    Hi all,

    I created an animation controller that controls the animation of a sprite.

    I want the sprite to be static and unchanged until I call one of the animation triggers.

    If I leave the first animation state empty, the blue progress bar loops in it over and over until a trigger is received.

    Does this looping through the empty animation state takes any performance?

    Is there a better way to handle empty animation states where I just want an object to remain as is?

    Thanks, any advice is appreciated.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    yes it take some cpu cycle to manage the time but you shouldn't worry about this, it's lightweight compare to other thing in unity.

    This how most user handle UI stuff, most of the time the 'idle' state usually called the normal state doesn't have any animation.
     
    HeatWave_Games likes this.
  3. HeatWave_Games

    HeatWave_Games

    Joined:
    Jun 3, 2016
    Posts:
    52
    Thank you for the quick answer.

    Could you tell which one is more efficient if I have many of these items at the same time?

    1. Let the 'idle' state loop

    2. Or create a 2 frame animation with two frames that are the same and play it once without loop?

    Also if the idle state is used is it more efficient in any way if the Speed of the 'idle' state is lowered to 0.01 or a similarly low number?

    Thanks
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    the fastest would be an empty state, simply because there is no need to evaluate animation curve and blend values.

    Changing the speed of the idle state won't have any effect on the performance, the state is still ticked at each update and at each update the time is always scaled with the state speed
     
    HeatWave_Games likes this.