In this sample we show how Amazon Transcribe, Amazon Translate, and Amazon Polly can be used together to produce a near real-time speech-to-speech translator solution for your next VR project. This repository is structured with a backend/ folder that contains CDK files to deploy AWS backend services, and a unity/vr-real-time-translation folder that contains the Unity VR project build using Unity version 2021.3.19f1.
This Unity VR project is designed to be customizable and can be used as a foundation to build your own multi-user VR experiences. You can use this project as a starting point to build a wide range of VR applications, including games, simulations, and training programs.
To get started, you can use the Unity Editor to modify the VR environment and game mechanics to suit your specific needs. You can also add new features and functionality, such as multi-user support, using AWS services like Amazon API Gateway, Amazon S3, and Amazon DynamoDB.
The project was created as a starting point for building your own custom VR experience, and with the included AWS backend resources, you can easily add multi-user support and cloud-based functionality to your app. With a little creativity and some programming skills, you can expand on this project to create your own unique and engaging VR experience.
Before you begin, please make sure you have the following:
- Unity installed on your computer.
- AWS CLI installed and configured with valid credentials (for AWS CDK deployment).
- Node JS and NPM to install CDK dependency
- Basic knowledge of Unity and AWS.
To get started with the Unity VR project, please follow these steps:
- Clone this repository to your local machine.
- Navigate to the
backend/
folder in the repository and install CDK dependency by runningnpm install
- Prepare your AWS account for the backend CDK application by running
cdk bootstrap
. Deploy the AWS backend services using the AWS CDK by runningcdk deploy
. - The deployment will output the following values which you will require later.
CognitoUserPoolId
,CognitoClientId
,IdentityPoolId
- Once the backend services are deployed, navigate to the
unity/vr-real-time-translation/Assets/Plugins
folder in the repository. - Download the following .NET DLL files and save to
Plugins
folder Download .NET DLL- Amazon.Extensions.CognitoAuthentication.dll
- AWSSDK.CognitoIdentity.dll
- AWSSDK.CognitoIdentityProvider.dll
- AWSSDK.Core.dll
- AWSSDK.Polly.dll
- AWSSDK.SecurityToken
- AWSSDK.Translate.dll
- Microsoft.Bcl.AsyncInterfaces.dll
- System.Runtime.CompilerServices.Unsafe.dll
- System.Threading.Tasks.Extensions.dll
- Open the Unity project in Unity version 2021.3.19f1. Unity Instructions
- In the Unity Editor, open the
Assets/ScriptableObjects/AWSConfig
and under Resources-> Cognito update theUser Pool ID
,App Client ID
, andIdentity Pool ID
values with the output of the cdk deploy command. - In the Unity Editor, open the
Assets/Scenes
folder and select Main scene. - Once the configuration is complete, you can run the Unity VR project.
To open the Unity project in Unity version 2021.3.19f1, please follow these steps:
NOTE: Since the AWS .NET SDK DLLs are not distributed with this repository, there will be numerous errors when the Unity project is first opened. Once the DLLs have been copied to the Unity project, these errors can be cleared.
- Install and open Unity Hub on your computer.
- Click on the "Projects" tab in the left-hand sidebar.
- Click on the "Open" button and select the folder where you cloned the Unity VR project repository.
unity/vr-real-time-translation
- Once the project is added to Unity Hub, click on the project tile to open it.
- In the project window, click on the Unity version dropdown menu and select "2021.3.19f1".
- Unity will automatically download and install the selected version of Unity.
- Once the installation is complete, the Unity VR project will open in the Unity Editor.
- After completing the above steps, you can continue with the instructions in the Readme file to configure the AWS backend services and update the AWS Config game object in the Unity project.
When using the AWS SDK for .NET and .NET Standard 2.0 for your Unity application, your application must reference the AWS SDK for .NET assemblies (DLL files) directly rather than using NuGet. For more information see
You can opt to obtain the .dll from nuget.org by downloading the corresponding package. After successful download, rename the file extension from .nupkg to .zip, extract the DLL from the designated path located in lib/netstandard2.0.
To use the app, you will need to create an account. This account will be created in the User Pool that is deployed via CDK. Cognito User Pool is a fully managed service provided by AWS that enables you to easily add user sign-up, sign-in, and access control to your web and mobile apps. Cognito User Pool acts as a user directory that can scale to hundreds of millions of users, so you don't have to worry about building and maintaining your own authentication system.
- In the Sign Up menu and fill in your full name, email address, username, and password.
- Keep in mind your email address will need to be verified before you can proceed.
- The password will need to meet certain complexity requirements, including a minimum length of 12 characters, at least one lowercase letter, one uppercase letter, one digit, and one symbol.
- Once you have filled in all the required information and completed the Sign Up process, you will receive an email verification with a link to confirm your account.
- After you have confirmed your account, return back to the application and continue with Sign In process.
- After a successful sign in - you will be presented with a drop down menu with three categories. Source Languages, Target Languages and Voice. Select your desired input values and click Start Translation.
- Speak into your microphone to start streaming your voice. You will see a translated text on the screen and audio playback via your speaker of the translated text.
- When you are done, press the Stop Translation button to close websocket connection.
We welcome contributions from the community to help improve and enhance this open-source Unity VR project. If you would like to contribute, please follow these guidelines:
Fork the repository and make your changes in a new branch. Submit a pull request with a detailed description of your changes. Your changes will be reviewed, and if approved, will be merged into the main branch.
This sample code is made available under the MIT-0 license. See the LICENSE file.