You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/D2D_Scripts/Gameplay/DoActionOnKeyDown.cs

21 lines
509 B
C#

3 months ago
using UnityEngine;
using UltEvents;
namespace D2D.Common
{
/// <summary>
/// When player started pressing the key, invokes the action.
/// Don`t use it in input, it is so laggy for it!
/// </summary>
public class DoActionOnKeyDown : MonoBehaviour
{
[SerializeField] private KeyCode keyCode;
[SerializeField] private UltEvent action;
private void Update()
{
if (Input.GetKeyDown(keyCode))
action?.Invoke();
}
}
}