Welcome to our in-depth guide on how to add AI companions, more commonly known as AI characters, to your Unity projects using the Convai SDK. Whether you're a game developer, game designer, or virtual world builder, this article will help you seamlessly integrate intelligent AI characters into your projects, enhancing player experiences with natural, real-time interactions.
Watch this in-depth step-by-step guide in action on our youtube tutorial:
Introduction
In the rapidly evolving world of game development, incorporating AI companions can significantly enhance the interactivity and immersion of your projects. Read more about it on our detailed blog on the rapid developments in AI companions for your virtual development. The Convai SDK for Unity allows you to create intelligent virtual agents that can converse naturally, perceive their virtual surroundings, and perform complex actions. This guide will walk you through the process of integrating the Convai SDK into your Unity projects, setting up your AI characters, and testing them in a new scene.
Before you get started, you’ll need to add the Convai SDK to your Unity account. To do this, download the Convai Asset for Unity from our documentation page by clicking on the download option for Unity Verified solutions, and adding the Convai asset to your account.
![](https://cdn.prod.website-files.com/63ea75dcbd94095356f1d43b/6686fff32d3fe7df4088ed05_3.png)
Setting Up Your Unity Project
![](https://cdn.prod.website-files.com/63ea75dcbd94095356f1d43b/66870008b570a4bf0efb897d_2.png)
To get started, create a new Unity project (download the Unity Hub to get started). Follow these steps:
1. Open Unity Hub: Launch Unity Hub and click on "New Project".
2. Select Template: Choose the 3D Core template.
3. Name Your Project: Enter a name for your project, e.g., "Unity AI Project".
4. Create Project: Click on "Create" and wait for Unity to set up your project environment.
Adding the Convai SDK
Now that your project is ready, let's add the Convai SDK:
1. Open Package Manager: Go to `Window > Package Manager`.
2. Search for Convai SDK: In the search bar, type "Convai" and find the Convai SDK under "My Assets".
3. Download SDK: If you haven't downloaded it yet, click on "Add to My Assets" and then "Download".
4. Import SDK: Click on "Import" and follow the prompts to install the SDK.
Importing Text Mesh Pro
Text Mesh Pro is essential for rendering text in Unity. To add it to your scene:
1. Open Text Mesh Pro: Go to `Window > Text Mesh Pro > Import TMP Essential Resources`.
2. Import Resources: Click "Import" and wait for the resources to be added to your project.
Configuring the Convai SDK
![](https://cdn.prod.website-files.com/63ea75dcbd94095356f1d43b/668700245cfab3e29ac6c764_4.png)
With Text Mesh Pro added, it's time to configure the Convai SDK:
1. Add API Key: Go to `Convai > Convai Setup`.
2. Copy API Key: Log in to the Convai Playground, copy your API key, and paste it into the setup window.
3. Test Setup: Click on "Test" to ensure the setup is working correctly.
Note: If you’re stuck at any step in this guide. Check out the information on our documentation page to learn more. Also keep up with our content on the YouTube channel, to become an expert on creating AI powered Unity projects.
Importing Custom Characters
![](https://cdn.prod.website-files.com/63ea75dcbd94095356f1d43b/6687003722406959cb4f477a_5.png)
To bring custom characters from the Convai Playground into your Unity project:
1. Select Character: In the Convai Playground, choose a character you want to import.
2. Copy Character ID: Copy the character's ID.
3. Import Character: Go to `Convai > Character Importer` in Unity, paste the character ID, and click "Import".
Testing Your Setup
After importing your character, it's essential to test the setup:
1. Run Scene: Click on the play button in Unity to start the scene.
2. Interact with AI: Check if the AI character responds naturally and performs actions as expected.
Use Cases for AI Companions
![](https://cdn.prod.website-files.com/63ea75dcbd94095356f1d43b/6687004c97bb294172d66a67_6.png)
Integrating AI companions into your Unity projects can open up a plethora of possibilities. Here are some use cases:
1. Enhanced Game Experiences: AI companions can provide guidance, enhance storytelling, and create dynamic interactions in games.
2. Generative AI Games: Develop games that adapt to player inputs in real-time, offering a unique experience each time. Check out our detailed blog on how AI characters are enhancing game experiences in 2024 on the Convai blog page.
3. AI Tutors: Create educational tools where AI companions act as tutors, providing personalized learning experiences.
4. Brand Agents: Use AI characters as brand representatives in virtual environments, enhancing customer engagement.
5. Virtual World Builders: Build immersive virtual worlds where AI inhabitants interact with users, making the environment feel more alive.
Conclusion
The Convai SDK for Unity empowers developers to create intelligent AI companions that enhance player experiences. By following this guide, you can seamlessly integrate these AI characters into your projects, creating more engaging and interactive virtual worlds. Whether you're a game developer, designer, or virtual world builder, the possibilities with AI companions are endless.
For more detailed tutorials and support, check out the Convai documentation. Also, if you reach out to us at support@convai.com for any questions or concerns. Furthermore, you can check out more of our tutorials on the Unity Integration playlist on our YouTube channel. Also, join our amazing developer community on Discord to learn more about integrating AI characters into different types of projects.