Skip to Content
Loremind Unity SDKOverview

About

Add AI-powered NPCs to your Unity game. Talk to them, and they respond with personality, knowledge, and awareness of their surroundings.

Quick Example

using Peek.LoreMind; var npc = GetComponent<LoreMindNPC>(); var response = await npc.RespondAsync("What do you know about the dragon?"); Debug.Log(response.response);

Two Ways to Use It

Editor Testing

During development, the SDK connects directly to LoreMind using a Server API Key stored locally. This lets you prototype quickly without setting up a backend.

// Works immediately in the Editor var response = await npc.RespondAsync("Hello!");

Your Server API Key is stored in Unity’s EditorPrefs and is never included in builds.

Production

When you ship your game, NPC requests route through your game server. Your server holds the API key securely and can:

  • Use your authentication system (Steam, Epic, custom)
  • Provide playerId for long-term memory
  • Add custom validation and rate limiting
Your Game → Your Server → LoreMind API

See Backend Integration for setup instructions.

SDK Components

LoreMindNPC

The core component. Attach to any GameObject to make it conversational:

var npc = GetComponent<LoreMindNPC>(); // Set context for better responses npc.SetLocation("Blacksmith Shop", "Hot, smell of metal"); npc.Context.timeOfDay = "evening"; // Talk to the NPC var response = await npc.RespondAsync("What can you forge?");

See LoreMindNPC Component for full documentation.

RuntimeContext

Pass situational information to improve NPC responses:

npc.Context.location = "Town Square"; npc.Context.timeOfDay = "dusk"; npc.Context.weather = "rainy"; npc.Context.npcMood = "cheerful"; npc.Context.playerAppearance = "battle-worn, carrying broken sword"; npc.Context.recentEvents = new[] { "Dragon spotted nearby" };

See Context System for details.

LocationZone

Trigger-based automatic location context. When an NPC enters a zone, their location context updates automatically:

// Attach to a trigger collider // NPCs entering the zone automatically know where they are

ContextTag

Mark GameObjects as perceivable by NPCs:

// Attach to characters, items, or landmarks // NPCs with AutoSenseNearby detect tagged entities

Voice Components

Optional voice input and output:

  • LoreMindVoiceInput - Speech-to-text using Whisper (local, offline)
  • LoreMindVoiceOutput - Text-to-speech using Kokoro (local, offline)

See Voice Input and Voice Output.

Long-Term Memory

NPCs can remember individual players across sessions:

npc.EnableMemoryRetrieval = true; npc.EnableMemoryStorage = true;

Requires: Production setup with playerId. See Long-Term Memory.

Documentation

Getting Started

Components

Reference

Platform

Last updated on