Unity Integration
Playprint's Unity integration brings player profiling and Ghost AI to C# games. Track decisions, extract playstyle profiles, and generate AI opponents that mirror real player behaviour — all running locally with zero server dependencies.
Status: Coming Soon. The Unity C# SDK is in active development targeting Unity 6. The API mirrors the TypeScript SDK — if you know one, you know both.
Planned API
The Unity SDK will follow the same pipeline as the TypeScript SDK, with C# idioms:
using Playprint;
// 1. Create a tracker
var tracker = new PlayprintTracker(new TrackerOptions {
GameId = "my-unity-game",
Storage = new PlayerPrefsStorage(), // or custom IStorageAdapter
});
// 2. Track decisions during gameplay
tracker.StartMatch();
tracker.Decision(new DecisionInput { Label = "attack" }); // risk inferred: 0.7
tracker.Decision(new DecisionInput { Label = "defend" }); // risk inferred: 0.2
tracker.Decision(new DecisionInput {
Label = "gamble",
Risk = 0.9f,
Information = 0.3f, // Tier 2: explicit values
});
// 3. Record outcomes
tracker.Outcome(new OutcomeInput { Type = "hit", Delta = 0.5f });
// 4. End match — returns updated profile
PlayprintData profile = await tracker.EndMatch("win");
// 5. Generate Ghost AI (8 biases — 6 core + 2 comms)
GhostBiases ghost = Ghost.Create(profile, commsProfile);
// ghost.Aggression = 0.72f, ghost.Expressiveness = 0.57f, ... Ghost AI for Unity NPCs
Map abstract ghost biases to your game's specific AI parameters — including communication biases for emotes and chat:
// Map ghost biases to game-specific AI behaviour
var aiParams = Ghost.MapBiases(ghost, new Dictionary<string, BiasMapping> {
// Core gameplay
["attackFrequency"] = new("aggression", 0.1f, 0.9f),
["retreatThreshold"] = new("patience", 0.2f, 0.8f),
["bluffChance"] = new("deception", 0.0f, 0.3f),
["reactionTime"] = new("consistency", 200f, 800f),
["riskThreshold"] = new("riskTolerance", 0.3f, 0.9f),
["targetSpread"] = new("reach", 1f, 4f),
// Communication
["emoteFrequency"] = new("expressiveness", 0f, 0.8f),
["tauntChance"] = new("provocation", 0f, 0.5f),
});
// Apply to your AI controller
enemyAI.AttackFrequency = aiParams["attackFrequency"];
enemyAI.EmoteFrequency = aiParams["emoteFrequency"]; Architecture
| Component | Description |
|---|---|
| PlayprintTracker | MonoBehaviour-compatible tracker. Attach to a GameObject or use as a plain C# class. |
| IStorageAdapter | Interface for persistence. Ships with PlayerPrefsStorage and InMemoryStorage. Implement for custom backends. |
| Ghost | Static class with Create() and MapBiases(). Accepts optional CommsProfile for communication biases. Pure functions, no MonoBehaviour required. |
| Archetype | Player classification — same 12 core archetypes as the TypeScript SDK. |
Storage Options
| Adapter | Persistence | Best For |
|---|---|---|
InMemoryStorage | Session only | Testing and prototyping |
PlayerPrefsStorage | Local device | Single-player games |
Custom IStorageAdapter | Your choice | Cloud saves, multiplayer, cross-device sync |
Decision Input Tiers
Same three tiers as the TypeScript SDK:
| Tier | C# Input | When to Use |
|---|---|---|
| 1 | new DecisionInput { Label = "attack" } | Quick integration — risk inferred from label keywords |
| 2 | new DecisionInput { Label = "attack", Risk = 0.8f, Information = 0.5f } | You compute your own risk/info values |
| 3 | Full DecisionPayload | Complete control over all fields |
Platform Support
- Unity 6+ (LTS) — primary target
- .NET Standard 2.1 — compatible with IL2CPP and Mono
- All platforms — PC, Mac, Linux, iOS, Android, consoles, WebGL
- Zero native dependencies — pure C#, no plugins required
Cross-Platform Profiles
PlayprintData is the same shape across all SDKs. A player profiled in Unity produces identical data to one profiled in TypeScript or Roblox. Ghost AI, archetypes, and friend codes all work cross-platform.
Get Notified
The Unity SDK is in active development. Join the waitlist to be notified when early access opens.
Current Options
While the native C# SDK is in development, Unity games can integrate with Playprint by:
- Using the TypeScript SDK via a companion web service
- Implementing the profile extraction algorithm directly in C# (the math is documented in Core Concepts)
- Partnering with us for early access — get in touch