Make sure to select Player Settings and set API Compatibility Level to. Go to Build Setting view of the project and switch it to iOS. Link the materials to code using InspectorĮxport the project to run on iOS platform Now link the materials to the variables accordingly using Inspector pane, and enter the API key you get from IBM Cloud for the STT service. SphereMeshRenderer.material = yellow_sphere SphereMeshRenderer.material = green_sphere Įlse if (("yellow")) SphereMeshRenderer.material = red_sphere Įlse if (("green")) Īnd this part is to set color for the sphere based on the key word found in the speech command Log.Debug("ExampleStreaming.OnRecognize()", text) These variables will then show in the Inspector view of ExampleStreaming asset in Unity. Now open the ExampleStream.cs file using a text editor and add these lines into the ExampleStream class after the declaration of ResultsField as following to declare the MeshRenderer and 3 materials as public variables. Create 3 asset materialsĪdd code to set colors of the sphere via voice command Name the materials red_sphere, green_sphere, yellow_sphere and set the color for each of them accordingly. Next step is to create 3 asset materials correspondingly to the 3 colors we want to set for the sphere. 3D Unity project viewĪfter that, add a Sphere and Plane 3D Game Object to the project (GameObject > 3D Object on the menu) Once the sdk-core and sdk artifacts are completely downloaded, pick the ExampleStreaming in the examples list to add into the project. Use git to clone the SDKs from IBM’s github to the Assets directory: $ git clone Import IBM Watson SDK for Unity to your Unity projectĬreate a 3D Unity project under which an Assets directory will be generated. You can either use the auto-generated key or create a new one as necessary. Once the service’s been created, navigate to the service’s Dashboard and grasp the “API Key” token to use later in the code. You first need to create a Watson STT service instance in IBM Cloud by logging to the platform using your IBM ID, then search for “Text to speech” from the Catalog and follow the instruction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |