Hello, Currently I am making a First Person Game. I have a Punching animation which works fine and I have a running animation that lasts for 1.25 sec. The running animation plays upon “W” keypress but then stops. How can I get the animation to continuously loop until W is no longer being pressed or is halted by other animation playing (such as the punching animation).
Thanks Guys.
(Sorry if this a noob question I’m only new.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class punch : MonoBehaviour
{
public GameObject Arms;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Punch"))
{
Arms.GetComponent<Animator>().Play("PunchRight");
}
if (Input.GetButtonDown("Run"))
Arms.GetComponent<Animator>().Play("Running");
}
}