2022-04-02 13:46:27 -04:00

11 lines
308 B
C#

using UnityEngine.InputSystem;
public static class Utils {
public static bool WasPressedThisFrame(this InputAction.CallbackContext ctx, ref bool lastValue) {
bool newValue = ctx.ReadValueAsButton();
bool wasJustPressed = !lastValue && newValue;
lastValue = newValue;
return wasJustPressed;
}
}