Hi Unity Community! Im trying to setup a script so that my character’s animations will play whenever I hold down a key and then release it. I had some errors so I checked the documentation and I corrected them but inside Unity it says “The best overloaded method for ‘UnityEngine.Animation.Play(UnityEngine.PlayMode’) has some invalid arguments”
Can anyone please explain what’s wrong and explain what does it mean? Thank you!!
using UnityEngine;
using System.Collections;
public class AnimAedan : MonoBehaviour {
public Animation AedanIdle;
public Animation AedanRunning;
public Animation AedanAttack1;
public Animation AedanAttack2;
public Animation AedanAttack3;
public Animation AedanAttack4;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
animation.Play(AedanRunning);
}
if (Input.GetKeyUp(KeyCode.LeftArrow))
{
animation.Play(AedanIdle);
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
animation.Play(AedanRunning);
}
if (Input.GetKeyUp(KeyCode.RightArrow))
{
animation.Play(AedanIdle);
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
animation.Play(AedanRunning);
}
if (Input.GetKeyUp(KeyCode.UpArrow))
{
animation.Play(AedanIdle);
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
animation.Play(AedanRunning);
}
if (Input.GetKeyUp(KeyCode.DownArrow))
{
animation.Play(AedanIdle);
}
}
}