- Home /
Joystick inputs on an inactive window?
Hey i have just finished a small script that shows images depending on what joystick buttons inputs you pressed, it works great!. but i notice when i click off the Window making it inactive it does not read the inputs?
i have checked Run In Background but i don't see any differences.
I'm wanting the user to be on another program then it shows what buttons they are pressing and be displayed on unity3d, it does work but not when its an inactive window.
please help!
This is standard behavior in a desktop environment. The active window gets input focus. This is a function of the operating system, not Unity.
are you sure? why would other programs work then? Example snes9x has "pause game when inactive" if i untick this i can play it as an inactive window but not in unity3d?
Answer by Dave-Carlile · Feb 16, 2013 at 05:46 PM
This is standard behavior in a desktop environment. The active window gets input focus. This is a function of the operating system, not Unity.
Arguably the best way to do what you want is using some sort of interprocess communication. Use Unity's networking and have the second app connect to the first and route the input to it using RPC calls.
There are also Win32 API calls to hook into input events so you can grab them and respond to them, but this would likely circumvent all of Unity's input handling, so you'd have to deal with that.
Answer by Elringus · Apr 12, 2018 at 07:32 PM
Check out this GitHub project: https://github.com/Elringus/UnityRawInput
It allows getting input events event when the application is not in focus.
Your answer
Follow this Question
Related Questions
Prevent Unity from Automatically Connecting to HID device 0 Answers
joystick plug/unplug during runtime on windows doesn't refresh 2 Answers
Using DPad/Joystick in "new" InputSystem as digital rather than analog 1 Answer
How to make virtual joystick (Windows Store)? 1 Answer
What to change in standard input modules for joystick, keyboard, and mouse input? 0 Answers