So for my character I have a animation controller. I have an animation attached that is named “Wave”. I need this animation to play when the Space Bar is pressed. So here’s the code I have : (FYI This script is attached to the action on the controller).
public class Wave : StateMachineBehaviour
{
public bool x = false;
public void Update()
{
if (x == true)
{
Animation.Play ("Wave");
}
if (Input.GetKey (KeyCode.Space))
{
x = true;
}
}
}
What's 'Animation' in the line
– aditya007Animation.Play ("Wave");?Probably something wrong with your start function mate :P
– Pigenator