文件名称:Mobile Speech Recognizer 1.2
文件大小:704KB
文件格式:UNITYPACKAGE
更新时间:2020-09-25 06:53:29
Mobile Speech Recognizer Unity
About
Wouldn't your prefer to let your users speak instead of
making them type?
This plugin uses OS components for speech recognition and send it to your
Unity scripts as String objects.
Plugin supports:
- Android >= 3.0 (haven’t tested below, it might work though… ),
- iOS >= 10.0.
That doesn’t mean you can’t target iOS lower than 10 - you simply have to
prepare fallback code to cover cases when user doesn’t have access to
speech recognition (SpeechRecognizer.EngineExists() for the help!). Keep in
mind that both iOS and Android might use Internet connection for speech
detection, which means it might fail in case there’s no active connection.
Plugin doesn’t work in Editor!
You have to run your app on real iOS or Android device.
MOBILE SPEECH RECOGNIZER - UNITY PLUGIN
?2
Quick Start
Open example scene
Go to KKSpeechRecognizer/Example folder inside Unity and open
ExampleScene:
It shows basic usage of a plugin, which is:
1. Detecting if speech recognition exists on user’s device (keep in mind that it
won’t be available on e.g. iOS 9 or old Android phones),
2. If it exists, and user clicks on “Start Recording” button it listens for
recognized text and displays it on a screen,
3. On Android, speech recognition automatically detects when user finishes
speaking, but on iOS we have to wait for user clicking “Stop Recording” to
finish whole process (i.e. get final results).
Before running it on Android or iOS device you have to…
Setup permissions
iOS
After generating Xcode project (keep in mind that you have to use Xcode 8 or
higher) you have to add two permissions keys to your project:
MOBILE SPEECH RECOGNIZER - UNITY PLUGIN
?3
NSMicrophoneUsageDescription
explanation from Apple docs:
This key lets you describe the reason your app accesses any of the the device’s
microphones. When the system prompts the user to allow access, this string is
displayed as part of the alert.
NSSpeechRecognitionUsageDescription
explanation from Apple docs:
This key lets you describe the reason your app sends user data to Apple’s speech
recognition servers. When the system prompts the user to allow access, this string is
displayed as part of the alert.
You can do it in two ways:
- Automatic (default and recommended)
Open KKSetSpeechRecognitionPermissionsoniOS script from Editor/
KKspeechRecognizer folder inside your project. Change values of those texts:
public static string microphoneUsageDescription = "Put something here about
microphone usage";
public static string speechRecognitionUsageDescription = "Put something here about
speech recognition usage”;
Generate your Xcode project. Your are ready.
- Manually
Disable KKSetSpeechRecognitionPermissionsoniOS script by either removing
it or setting shouldRun variable to false.
After generating your Xcode project open Info.plist file and right-click on it and
click “Add row”. Then enter two required two keys with descriptions.
In the end it should look like it:
Android
MOBILE SPEECH RECOGNIZER - UNITY PLUGIN
?4
You must add those two permissions to your AndroidManifest.xml: