- Home /
Question by
HazyCarnation · Oct 07, 2016 at 10:08 PM ·
c#animationanimatorgetcomponentsetfloat
Why isn't the animator getting my values?
public class Sword: MonoBehaviour {
public PlayerController playerController;
private Animator anim;
public Vector2 lastMove;
void Start() {
anim = GetComponent<Animator> ();
}
void Update() {
if (playerController.lastMove == null) {
print("lastmove is null");
}
lastMove.y = playerController.lastMove.y;
lastMove.x = playerController.lastMove.x;
anim.SetFloat ("LastMoveX", lastMove.x);
anim.SetFloat ("LastMoveY", lastMove.y);
anim.SetBool ("Sword", playerController.attacking);
}
}
The code is getting the variables as I want them, as I can see the numbers changing in Unity. I can't see the numbers changing in the animator for some reason though, even though this is how I have applied variables to the animator before. What am I doing wrong?
Comment
Your answer
Follow this Question
Related Questions
error CS0029: Trying to access component in parent - c# 2 Answers
Play anaimation when key pressed 1 Answer
Animator is not playing a Playable 3 Answers
MatchTarget and Looping Animations? 0 Answers