Windows Raw Input wrapper for Unity game engine
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Assets initial commit Apr 12, 2018
ProjectSettings initial commit Apr 12, 2018
UnityPackageManager initial commit Apr 12, 2018
.gitattributes 🎉 Added .gitattributes Apr 12, 2018
.gitignore initial commit Apr 12, 2018
LICENSE add license Apr 12, 2018 update readme Apr 14, 2018

Download package

For Unity 2017.4 and later: UnityRawInput.unitypackage.


Wrapper over Windows Raw Input API to hook for the native input events. Allows to receive input events even when the Unity application is in background (not in focus).

Will only work on Windows platform.

Only keyboard input is currently supported.


Include package namespace.

using UnityRawInput;

Initialize the input service to start processing native input messages.


Optinally, you can specify whether input messages should be handled when the application is not in focus (disabled by default).

var workInBackground = true;

Add listeners for the input events.

RawKeyInput.OnKeyUp += HandleKeyUp;
RawKeyInput.OnKeyDown += HandleKeyDown;

private void HandleKeyUp (RawKey key) { ... }
private void HandleKeyDown (RawKey key) { ... }

You can also check whether specific key is currently pressed.

if (RawKeyInput.IsKeyDown(key)) { ... }

You can stop the service at any time.


Don't forget to remove listeners when you no longer need them.

private void OnDisable ()
    RawKeyInput.OnKeyUp -= HandleKeyUp;
    RawKeyInput.OnKeyDown -= HandleKeyDown;