elringus/unity-raw-input
关于
Windows Raw Input wrapper for Unity game engine
游戏与模拟器实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Description
Wrapper over Windows Raw Input API to hook for the native input events. Allows receiving input events even when the Unity application is in background (not in focus).
Will only work on Windows platform.
Only keyboard and mouse input is detected.
Installation
Download and import the package: UnityRawInput.unitypackage.
Usage
Enable Run In Background in project's player settings; if not enabled, expect severe mouse slowdown when the application is not in focus https://github.com/elringus/unity-raw-input/issues/19#issuecomment-1227462101.

Initialize the service to start processing input messages:
RawInput.Start();
Optionally, configure whether input messages should be handled when the application is not in focus and whether handled messages should be intercepted (both disabled by default):
RawInput.WorkInBackground = true;
RawInput.InterceptMessages = false;
Add listeners to handle input events:
RawInput.OnKeyUp += HandleKeyUp;
RawInput.OnKeyDown += HandleKeyDown;
private void HandleKeyUp (RawKey key) { ... }
private void HandleKeyDown (RawKey key) { ... }
Check whether specific key is currently pressed:
if (RawInput.IsKeyDown(key)) { ... }
Stop the service:
RawInput.Stop();
Don't forget to remove listeners when you no longer need them:
private void OnDisable ()
{
RawInput.OnKeyUp -= HandleKeyUp;
RawInput.OnKeyDown -= HandleKeyDown;
}
Find usage example in the project: https://github.com/elringus/unity-raw-input/blob/main/Assets/Runtime/LogRawInput.cs.
List of the raw keys with descriptions: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes.
The plugin is used in Naninovel: Visual Novel, Dialogue & Cutscene Storytelling Engine. Check it out!

探索相关项目
加载中…