I tried using Input.GetButtonDown for my animation but instead of playing the animation it just stutters…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public GameObject thePlayer;
public float horizontalMove;
public float verticalMove;
public int horizontalMoveSpeed;
public int verticalMoveSpeed;
void Update()
{
if (Input.GetButton("Horizontal") || Input.GetButton("Vertical"))
{
thePlayer.GetComponent<Animation>().Play("Walk");
horizontalMove = Input.GetAxis("Horizontal") * Time.deltaTime * horizontalMoveSpeed;
verticalMove = Input.GetAxis("Vertical") * Time.deltaTime * verticalMoveSpeed;
transform.Rotate(0, horizontalMove, 0);
transform.Translate(0, 0, verticalMove);
}
else
{
thePlayer.GetComponent<Animation>().Play("Idle");
}
if (Input.GetButtonDown("Fire2"))
{
thePlayer.GetComponent<Animation>().Play("StartAim");
}
}
}
this is the point of interest…
if (Input.GetButtonDown("Fire2"))
{
thePlayer.GetComponent<Animation>().Play("StartAim");
}
I’m not getting any errors…
I’m using legacy animations because it’s easier IMO…