i have a code like this , when i press Q attack animation plays. i want to set this to UI button how can i do that?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCombatController : MonoBehaviour
{
Animator animator;
private void Start()
{
animator = GetComponent<Animator>();
}
private void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animator.SetTrigger("attack");
}
}
}
