Skip to Content
Loremind Unity SDKOverview

Overview

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 your project’s local editor settings 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

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. Attach it to a trigger collider — NPCs entering the zone automatically know where they are.

ContextTag

Mark GameObjects as perceivable by NPCs. Attach it to characters, items, or landmarks — NPCs with AutoSenseNearby detect tagged entities.

Voice Input

Optional speech-to-text so players can talk to NPCs:

  • LoreMindVoiceInput - Speech-to-text using Whisper (local, offline)

See Voice Input.

Long-Term Memory

NPCs can remember individual players across sessions:

npc.EnableMemoryRetrieval = true;

Memory storage is automatic when a playerId is provided and memory is enabled for the project.

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

Documentation

Getting Started

Components

Editor Tools

  • Lore Sync - Pull your project’s lore data from the dashboard into the Unity Editor

Reference

Platform

Last updated on