Unity Speech Recognition doesn't work while program is running in background

Hey,
I have a problem with the Speech Recognition. It seems like the speech recognition stops working everytime you switch the focus to another program. I already searched google and the forums for similar problems and it seems like there are multiple people with the same problem but non have found any solution. I was wondering if there is a fix for it? Is it a unity problem, or a windows problem? Maybe someone of you have an idea what causes this behaviour.

I never posted on this forum until now, so im not entirly sure if it is correctly placed

What speech recognition are you talking about? The built-in phrase recognition system for Windows, or something else?

Is your application set to run in the background? Does the rest of the program run when it doesn’t have focus? Editor, build, or both?

More fundamentally, what platform / operating system are you running this on?

Each section has a description under its name on the front page. Make sure you read those.

1 Like

I just ran into the same issue. I’m on windows 10, using the built-in phrase recognition system for Windows.

My application set to run in the background, and the rest of the program runs fine. I am running in editor. For my purposes I won’t need to run in builds anytime soon.

I do however need to run my app in editor while another application has focus. In this scenario, voice recognition does not seem to work.

Any tips appreciated!

Same issue here, My app needs to be able to run in background and the UnityEngine.Windows.Speech KeywordRecognizer doesn’t work when the app is not in focus. I have already toggled the Run In Background in the build settings.

This is a limitation of Windows. Probably related to privacy policies.

How is it a limitation? There are lots of apps like Discord that use mic while working in the background

UnityEngine.Windows.Speech is implemented through https://docs.microsoft.com/en-us/uwp/api/windows.media.speechrecognition.speechrecognizer?view=winrt-22621. The speech recognition callbacks just don’t seem to be called when the app is not in foreground. I don’t know why that is. We’re not using the microphone directly.

1 Like