BITM3223 Lab Activity: Implementing Voice Commands in Unity
Objective: Students will learn to integrate basic voice recognition into a Unity project using the KeywordRecognizer class. This will enable the application to respond to specific voice commands, enhancing interactivity within a VR environment. Instructions: A) Scene setup Add a simple environment (e.g., a plane as the ground and a few 3D objects). B) Enabling Microphone Allow microphone access in Unity Editor as below: Windows: Settings ▶️ Privacy ▶️ Microphone and make sure Unity is enabled. Rewrite the C# script and attach the script to any GameObject in your scene and run it. Check the console for microphone names. (idk there no C in the Lab Activity) D) Voice command scripting 1. Create a new C# script for voice command. 2. Insert the following “using directives” - They are instructions to the C# compiler that tell it which namespaces you're going to use in the script. This allows you to access classes and functions from those namespaces without writing the full path every time. 3. Declare the keyword recognizer: 4. Initialize the keywords in void Start function: 5. Create the function to recognize the command: 6. Create function for each command: 7. Attached to the GameObject that we want to interact and run the project.
Download
0 formatsNo download links available.