Hy, I need to activate one animation when I press one Key whit my Player, how can I do?. The script its on colider and works but I can’t add the key.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class animator2 : MonoBehaviour
{
[SerializeField] private Animator myAnimatorController;
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
myAnimatorController.SetBool("transition1", true);
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
{
myAnimatorController.SetBool("transition1", false);
}
}
}