1. Create Animation Clips
- Window -> Animation -> Animator
- Select an object, hit the record red button, do some movement for your object
2. Create Animator Controller
- go to project window
- Right-click -> Create -> Animator Controller -> double click it
- Drag and drop all of your animation clips into the popup layer. (after this, you’ll get a lot of colorful blocks)
3. Attach the Animator Controller into your object, and also create a new script for your object
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move_the_ceiling : MonoBehaviour
{
Animator anim;
void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Keypad0)) {
anim.Play("animation clip filename 1");
else if (Input.GetKeyDown(KeyCode.Keypad1)) {
anim.Play("animation clip filename 2");
}
}
}
4. Animation Transition (It’s a little bit complex, not recommend to learn)
https://youtu.be/PNsM9ULD9fk