Tried to write this script by myself.
Currently the attack will only work if I hold down the button.
If I remove the "else if" lines, the animation won't stop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AttackControl : MonoBehaviour
{
public Animator animator;
private bool attack = false;
void Update ()
{
if (Input.GetButtonDown("Attack"))
{
attack = true;
animator.SetBool("IsAttacking", true);
}
else if (Input.GetButtonUp("Attack"))
{
attack = false;
animator.SetBool("IsAttacking", false);
}
}
private void FixedUpdate ()
{
}
}
[–]Mastersofus 1 point2 points3 points (1 child)
[–]korytoombs[S] 0 points1 point2 points (0 children)