I have a dance game and I want to smooth transitions… I want somehow to make each time I click button start it from Idle state
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Robber : MonoBehaviour {
public Animator anim;
// Start is called before the first frame update
void Start()
{
anim = GetComponent ();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown (“0”))
{
print (“Idle”);
anim.Play (“Idle”, -1, 0f);
}
if (Input.GetKeyDown (“1”))
{
print (“Slowdance”);
anim.Play (“slow_dance”, -1, 0f);
}
if (Input.GetKeyDown (“2”))
{
print (“Middance”);
anim.Play (“Mid_dance”, -1, 0f);
}
if (Input.GetKeyDown (“3”))
{
print (“Fast_dance”);
anim.Play (“Fast_dance”, -1, 0f);
}
}
}