https://github.com/connffuused/unity-input-interceptor
this plugin allows your script to determine when to intercept a player's keyboard input on Windows.
https://github.com/connffuused/unity-input-interceptor
input intercept unity windows
Last synced: about 2 months ago
JSON representation
this plugin allows your script to determine when to intercept a player's keyboard input on Windows.
- Host: GitHub
- URL: https://github.com/connffuused/unity-input-interceptor
- Owner: connffuused
- License: mit
- Created: 2022-06-25T08:41:01.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-26T10:41:40.000Z (about 4 years ago)
- Last Synced: 2025-09-23T15:51:55.163Z (9 months ago)
- Topics: input, intercept, unity, windows
- Language: ShaderLab
- Homepage:
- Size: 1.27 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unity input interceptor
This plugin allows your script to determine when to intercept a player's keyboard input on Windows.
## usage
```csharp
using Calci;
...
bool consumeEvent;
void OnEnable() {
IKeyCodeHandler handler = new MyKeyCodeHandler();
Interceptor.SetKeyCodeHandler(handler);
Interceptor.SetManagePressedKey(true);
Interceptor.SetKeyDownCallback(OnKeyDown);
Interceptor.SetKeyUpCallback(OnKeyUp);
bool result = Interceptor.Hook();
}
void OnDisable() {
bool result = Interceptor.Unhook();
}
bool OnKeyDown(int keyCode)
{
KeyCode key = (KeyCode)keyCode;
string txt = $"KeyDown: {key}";
Debug.Log(txt);
return consumeEvent;
}
bool OnKeyUp(int keyCode)
{
KeyCode key = (KeyCode)keyCode;
string txt = $"KeyUp: {key}";
Debug.Log(txt);
return consumeEvent;
}
```
## install
copy `Packages/com.seonghwan.windows.interceptor` into `Packages/`in your project.