Unity SDK Overview
Integrate AI text generation, image generation, speech recognition, and NPC conversations in Unity games
Unity SDK
The PlayKit Unity SDK allows you to integrate AI capabilities into Unity games, including text generation, image generation, speech recognition, and an NPC conversation system. The SDK provides a simple API that lets you quickly add intelligent interaction features to your games.
For example, you can use the SDK to create an NPC that understands player questions and responds appropriately, or generate in-game image assets based on player descriptions.
Before You Begin
- You need to create an application on the PlayKit Platform and obtain a Game ID
- Unity 2020.3 or later is required
Features Overview
Text Generation
The SDK provides three ways to generate text:
- Basic Conversation: Multi-turn dialogue with AI, manually managing conversation history
- Streaming Response: Receive AI-generated text in real-time
- Structured Output: Get type-safe structured data based on JSON Schema
NPC Conversation System
The DW_NPCClient component simplifies NPC dialogue implementation. It automatically manages conversation history - you just need to set up the character's system prompt and call the Talk() method.
Image Generation
Generate images using natural language descriptions, supporting multiple sizes (256x256 to 1792x1024). Generated images can be directly converted to Unity's Texture2D or Sprite types.
Speech Recognition
The SDK includes built-in microphone recording and Voice Activity Detection (VAD). You can record player speech and convert it to text, suitable for voice commands or chat features.
Included Dependencies
The SDK will automatically prompt you to install the following dependencies:
- UniTask
- Newtonsoft.Json