Prerequisites
- Unity 2023.2 or later (Unity 6 recommended)
- iOS Build Support module installed in Unity Hub
- Android Build Support module installed in Unity Hub (includes SDK, NDK, JDK)
1. Download the Plugin
Download the latest archive file for the Unity plugin. The archive contains both Android and iOS SDKs as well as the ASR Bundle.
2. Unpack the Archive
Unpack the plugin archive into your Unity project root:
tar xzf KeenASR-Unity-CUSTOMER-vVERSION-HASH.tgz -C /path/to/your/unity/project
This creates the following structure in your project:
Assets/
Plugins/
KeenASR/ C# scripts, native bridges, SDK frameworks
iOS/ KeenASR.xcframework, KeenASRBridge.m
Android/ KeenASR.aar, KeenASRAndroidUnityBindings.aar
Editor/ PostBuildProcess.cs (iOS post-build automation)
StreamingAssets/
keenA1m-nnet3chain-en-us/ ASR bundle (acoustic model)
The archive also includes Assets/TestKeenASR.cs, a sample scene controller that demonstrates initialization, decoding graph creation, listening, and result handling. You can use it for quick verification or remove it once you have integrated the plugin into your own code.
Assets/Plugins/KeenASR. If multiple copies exist (for example, from a previous installation), Unity will report linking errors due to duplicate symbols..meta files that configure platform-specific import settings (framework embedding on iOS, plugin architecture on Android). Do not delete them.Using TestKeenASR.cs for a Quick Test
When creating a new project for testing, the Universal 3D template is a good starting point.
- Open your Unity project
- Create a new scene (or use the default scene)
- Create an empty GameObject (GameObject > Create Empty)
- Drag
Assets/TestKeenASR.csonto the GameObject to attach it - Make sure the scene has a Camera (the script uses
Camera.main) - Build and run on a device or simulator
The sample app shows a Start Listening button. Tap it, say one of the color words (e.g. “RED”, “BLUE”, “GREEN”), and the recognized text appears on screen.
3. Microphone Permission
iOS: Handled automatically. The plugin’s PostBuildProcess.cs adds NSMicrophoneUsageDescription to the Xcode project’s Info.plist during build. Review and edit the description in this file as needed.
Android: The RECORD_AUDIO permission is declared in the KeenASR AAR’s manifest and merged automatically during the Android build. Runtime permission must still be requested in code (see Quick Start).
4. Verify the Setup
Build and run on a device (or iOS Simulator with Unity 6 on Apple Silicon). You should see log output:
Keen: Initializing KeenASR Plugin
If initialization fails, check that:
- The ASR bundle exists in
StreamingAssets/and the name matches exactly - Microphone permission is granted
Platform Notes
iOS:
KeenASR.xcframeworkis automatically embedded and signed byPostBuildProcess.cs- iOS Simulator requires Unity 6 on Apple Silicon (arm64); Unity 2023 only has x86_64 simulator support, which is not compatible with the KeenASR framework
Android:
- IL2CPP scripting backend is required for ARM64 builds
- The ASR bundle is automatically copied from
StreamingAssetsto internal storage on first launch - Initialization is asynchronous on Android. Always wait for the
onInitializedReceivedcallback before using the recognizer
Upgrading from a previous plugin version: We recommend completely removing the old plugin (Assets/Plugins/KeenASR directory) before installing the new version.
