11 lines
308 B
C#
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;
|
|
}
|
|
} |