Hey guys,
So I’ve got a unity app running in a browser. I have several ‘key’ shortcuts - like 1,2,3,4 changes cameras, t = zoom towards etc.
Only problem is, when users are typing in say a Word doc and the browser is concurrently open, the unity object still responds to the keys!
I want a way to block key inputs if the unity object is not currently active. The object still needs to be ‘playing’ while inactive though.
Cheers
Disable “run in background” in the project settings?
Yeah, so the problem with that is that I still need the object to ‘run in background’ - ie: objects should still keep moving around etc, but I just don’t want it to respond to ‘key presses’ in background.
Would this be a javascript thing, or an internal unity thing?
Cheers in advance
I’ve had a javascript guru in our team take a look at this, and he concluded that it’s not possible to block key inputs from the web page itself because Unity has its own event listener.
Without focus, the unity web player responds to key presses in any external app (eg: MS Word) - and even during typing a URL in the top bar of the browser.
Consequently, our app goes a bit crazy if someone is typing away elsewhere, because we have shortcuts that control camera changing!
Be great if someone from unity could give me a hand with this… I need to block key inputs when unity is not in focus, but still leave the app running in the background (ie: still allow objects to move around).
Cheers