I’m creating an FPS melee combat system (in which both arms are visible). I have created two attack animations along with an idle animation. The idle animation is specific to the left arm, therefore the right arm does not move during the idle animation. However, during the attack animations both arms move simultaneously. I have created a C# script that will play the animations when a certain key is pressed,but I came across a problem. In the beginning of the game the idle animation is playing on the left arm
(like it’s supposed to), however, when I play the attack animation on the right arm, the left arm stops playing the idle animation all together. I have been trying different ways to fix this but nothing seems to work. Is there a way that can cross fade between the animations? PLEASE HELP
here is the script I created :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArmAnims : MonoBehaviour {
void Start ()
{
GetComponent<Animation>().Play("Idle_Left_Arm");
}
void Attack1()
{
GetComponent<Animation>().Play("Attack1_Right_Arm");
}
void Attack2()
{
GetComponent<Animation>().Play("Attack2_Right_Arm");
}
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
Attack1();
}
if (Input.GetButtonDown("Fire2"))
{
Attack2();
}
}
}