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; } }