My script was working perfectly but my animation controller disappeared, I made a new one but for some reason the script is no longer changing my animation state. This is my script;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimScript : MonoBehaviour {
private Animator anim;
void Start () {
anim = GetComponent <Animator> ();
}
void Update () {
if (Input.GetKeyDown ("up")) {
anim.SetInteger ("State", 1);
}
if (Input.GetKeyUp ("up")) {
anim.SetInteger ("State", 0);
}
}
}
My animation controller is called Animations but I don’t think that should matter, what am I doing wrong??
That wasn’t my screenshot above, that was someone’s example this is what I’m working with:
I didn’t need an avatar before, this issue is that my script is not accessing my state variable inside the animator and I’m not sure why.
I GOT IT! The answer wasn’t in the question so you guys couldn’t have figured it out but I really appreciate the effort. My issue was that “State” in the animator was actually a float value, not an integer, and so it was not changing the value. I really appreciate the help though, you guys are awesome!