Docsv2.12.12
Back to API Reference
Class

InputUtils

static

Backend-agnostic input reads. Calling Input directly throws an InvalidOperationException every frame when the project's active input handling is set to the Input System package only; these route to Keyboard.current / Mouse.current in that configuration, to legacy Input otherwise.

public static Vector2 MousePosition{ get }

Pointer position in screen pixels, origin bottom-left (as mousePosition).

public static string InputString{ get }

Characters typed this frame. Backend-safe equivalent of inputString.

public static bool GetKey()

Whether key is currently held. Backend-safe equivalent of GetKey.

public static bool GetKeyDown()

Whether key went down this frame. Backend-safe equivalent of GetKeyDown.

public static bool GetMouseButtonDown()

Whether mouse button (0 = left, 1 = right, 2 = middle) went down this frame. Backend-safe equivalent of GetMouseButtonDown.

public static bool GetTouchBegan()

Whether a primary touch began this frame.