How to play animation at runtime to override timeline temporarily?

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?

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.

Thanks for reply. Your link is broken. Do you mean Unity Blog

I have read this article before, but it does not mention its ability to override timeline! It is a very useful feature. I will give it a try.