Search Unity

How to play animation at runtime to override timeline temporarily?

Discussion in 'Timeline' started by EthanF4D, May 14, 2018.

  1. EthanF4D

    EthanF4D

    Joined:
    Jan 9, 2018
    Posts:
    13
    Hi I am making a interactive car chasing scene. You are one of the bad guys in a car holding a gun. The timeline involves
    1. your car “driving through the city” by animator track.
    2. The police car “chasing your car” by animator track.
    3. A police (Police Alpha) will “shoot at you from its window” by animator track.

    When the cars are close enough, a sign will appear to prompt you to shoot back at Police Alpha. If he takes enough damage, I would like to
    4. “halt his shooting and retreat from his window for a while” (this is also animation clip).

    I tried to call his Animator.Play(“Retreat”) but it seems that Timeline overrides any animations. Is there a way to override timeline temporarily?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    You can override timeline by using Animation Playables directly. They will override timeline in the exact same way timeline overrides the state machine.

    You can script your own, or use the simple animation component to get you going.
     
    Last edited: May 14, 2018
  3. EthanF4D

    EthanF4D

    Joined:
    Jan 9, 2018
    Posts:
    13