I’ve been trying to figure out a way to run two builds (exe files) at the same time, on the same computer, and both have them register inputs. For example, if I hit “d,” the characters in both games will react. The way windows seems to work is that inputs will only work on the active window and not the other. Any work arounds?
Thanks
To my knowledge only a single window at a time can receive keyboard input. A couple of options:
- Add networking - when a key is hit in the active app, use RPC to send the key event to the other client. This is probably your best option.
- If using Windows (and probably possible on other OSes too) you can write an app that hooks into keyboard events and generates window messages to both apps. This is ugly and hacky, but can be done. Or both apps can hook into the keyboard messages, but this basically eliminates usage of the built in input handling in Unity.
- Windows also supports “object linking and embedding”, or whatever they’re calling it nowadays. This is a method for interprocess communication that lets one process subscribe to data from another. If this even still works, it’s probably very messy to set up.
The common theme here is that you need some sort of interprocess communication where one app sends input events to the other.