So I have this class and for some reason it just stopped working and is getting caught at
if(anim.GetCurrentAnimatorStateInfo(0).IsName(“Base.Special”))
Not sure what to do now cause I had it working at one point but it would keep getting stuck at
if(opened == true)
{
Here is my Class:
private Animator anim;
private bool readyToHatch;
public bool hatch;
private bool open;
private bool opened;
void Start ()
{
anim = GetComponent<Animator>();
readyToHatch = false;
StartCoroutine(EggTimer());
}
void Update ()
{
Egg();
}
void Egg()
{
if(readyToHatch == true)
{
anim.Play("Shaking");
}
if(hatch == true && readyToHatch == true)
{
readyToHatch = false;
anim.Play("Special");
if(anim.GetCurrentAnimatorStateInfo(0).IsName("Base.Special"))
{
open = true;
}
}
if(open == true)
{
hatch = false;
anim.Play("Hatch");
if(anim.GetCurrentAnimatorStateInfo(0).IsName("Base.Hatch"))
{
opened = true;
}
}
if(opened == true)
{
open = false;
anim.Play("Opened");
StartCoroutine(ShellTimer());
}
}
private IEnumerator EggTimer()
{
yield return new WaitForSeconds(1);
readyToHatch = true;
}
private IEnumerator ShellTimer()
{
yield return new WaitForSeconds(1);
print("Destroyed");
Destroy(gameObject);
}
public void HatchButton()
{
hatch = !hatch;
}
}
Here is my Inspector:

Here is my Animator:

I am trying to make it go from shaking(a looping animation) to special (when hatch is called) to hatch, to opened(another looping) and when its at opened run the timer to destroy itself.
If I must do it a different way I’m up for it as long as I don’t have to drag anything into the inspector because this class is for multiple prefabs to use.