Search Unity

Enabling / Adding Animator component and Playing a State Instantly. NO WAY!

Discussion in 'Animation' started by Guirao, Mar 10, 2014.

  1. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    So apparently Unity decided to mess up and delete the old way of animating things via the Animation component. Now If I want to for instance animate the camera position it creates an animator controller for me and adds the animation.

    And this is horrible, It forces to be in a state at all time. So, what If I wanted to Play some animation and then stop it and do some transforms via script? Well that's what I want to do. I've ended up destroying/enabling the Animator component, and when I want to control the object via script add it again, then play my animation.

    The problem, when I add the Animator component (or doing .enabled = true), I want to instantly Play an animation, however, it takes two frames to do it. That means there a frame where the positions and everything is messed up.

    Good job Unity.
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    The Animator is added by default, but you can still animate the old way, just get rid of the Animator and replace it with Animation.

    I too have noticed that calling animator.Play is not instant, (called from Update not LateUpdate).