- Home /
Playing animations in sequence for different objects
So in a scene, I'm hoping to animate two different objects, one after the other, with object 2 beginning when object 1 has completed animating.
Object 1 is a camera that just rotates to bring a scene into view, and once the camera has finished rotating, I'm looking to animate Object 2 which right now is just a box that falls into the scene. I have both of these objects animated on their own in unity, but can't figure out how to trigger one animation and then the next.
Is there a way to see via scripting if Object 1/the camera has finished it's animation?
Here is a sample script that currently has the two animations running at the same time:
using UnityEngine;
using System.Collections;
public class AnimController : MonoBehaviour {
public GameObject Camera;
public GameObject myBox;
// Use this for initialization
void Start () {
Camera.GetComponent<Animation>().Play("CameraRotate");
myBox.GetComponent<Animation>().Play("boxFall");
}
// Update is called once per frame
void Update () {
}
}
Answer by diggerjohn · Jul 06, 2018 at 05:47 PM
Look into animation events. Set an event at the end of one that sets off the next. In combination with MechAnim this is pretty effective.
Your answer
![](https://koobas.hobune.stream/wayback/20220611230127im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers
How to make animation keep value after transition 2 Answers
Is there a better way of using 2D PNG Sequence Animations? 1 Answer
Assets corrupted and couldn't build in standalone player 0 Answers