Smart NPCs Quick Start Guide
Smart NPCs Quick Start GuideLet's get started with adding voice to your game characters. This guide will show you how to implement Smart NPCs in your Unity project.
Adding Your First Smart NPC
Adding Your First Smart NPCYou have two ways to implement a Smart NPC:
Method 1: Through Code
Method 1: Through CodeCreate a new script (e.g., ExampleSmartNPC.cs) with this basic implementation:
using SkillfulAI.SmartNPCs;
using UnityEngine;
public class ExampleSmartNPC : MonoBehaviour
{
private void Start()
{
// Add the Smart NPC component
SmartNPC myNpc = gameObject.AddComponent<SmartNPC>();
// Set a voice by category
VoiceSelector.SetVoiceByCategory(myNpc, VoiceCategories.Female);
// Set the output audio source for the NPC.
myNpc.audioSource = gameObject.AddComponent<AudioSource>();
// Make the NPC speak!
myNpc.Speak("Hello! I'm your first Smart NPC!");
}
}Method 2: Using the Unity Inspector
Method 2: Using the Unity InspectorCreate an empty GameObject
Add the SmartNPC component

Add an AudioSource component (required for speech playback)
Create a script to interact with it:
Voice Selection Options
Voice Selection OptionsSmart NPCs offers several ways to select voices:
Customizing Voice Settings
Customizing Voice SettingsFine-tune your NPC's voice characteristics:
Integrating with Skillful Agents
Integrating with Skillful AgentsCreate an NPC that can think and speak:
Managing Speech Queue
Managing Speech QueueHandle multiple speech requests:
Creating a Basic Dialogue System
Creating a Basic Dialogue SystemImplement a simple dialogue system:
Next Steps
Now that you have your Smart NPC working, consider:
Experimenting with different voices and settings
Creating more complex dialogue systems
Implementing voice-based tutorials
Adding ambient NPC chatter
Creating voiced cutscenes
Check out the Service Reference for more detailed implementation options and advanced features.
Last updated