Ive got this irritating error which says "No overload for method ‘getcomponent’ takes 1 arguments.
here is the code
using UnityEngine;
using System.Collections;
public class Character : MonoBehaviour {
public float speed;
public Animator player;
public Animation front;
public Animation frontIDLE;
public Animation back;
public Animation backIDLE;
public Animation left;
public Animation leftIDLE;
public Animation right;
public Animation rightIDLE;
// Use this for initialization
void Start () {
player = gameObject.GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
//here is where I get all the errors v
front = gameObject.GetComponent<Animation> ("WalkFront");
frontIDLE = gameObject.GetComponent<Animation> ("WalkFrontIDLE");
back = gameObject.GetComponent<Animation> ("WalkBack");
backIDLE = gameObject.GetComponent<Animation> ("WalkBackIDLE");
left = gameObject.GetComponent<Animation> ("WalkLeft");
leftIDLE = gameObject.GetComponent<Animation> ("WalkLeftIDLE");
right = gameObject.GetComponent<Animation> ("WalkRight");
rightIDLE = gameObject.GetComponent<Animation> ("WalkFRightIDLE");
//here is where I get all the errors ^
}
void WalkFront (){
if (Input.GetKeyDown (KeyCode.W)) {
front.Play ();
transform.Translate (Vector2.up * speed * Time.deltaTime);
}
if (Input.GetKeyUp (KeyCode.W)) {
front.Stop ();
frontIDLE.Play ();
}
}
}
im a beginner so plz help and quick!!!