// Reference

Every public method on the Traced SDK.

The Traced Unity SDK is a single static class. Every method is safe to call before Init() — bad calls return silently rather than throwing. The SDK never blocks the main thread, never allocates in steady-state, and never crashes your game.

Init / Lifecycle

Init(TracedConfig config)

Initialize with a ScriptableObject config. Safe to call more than once.

Traced.Init(myConfigAsset);

Init(string apiKey, string projectId, string ingestUrl = null)

Convenience overload — build a transient config from explicit values. Prefer the ScriptableObject overload for production.

Shutdown()

Tear down the SDK. Stops the flush loop, destroys the runner, drops the config.

Flush()

Force a flush of pending events. Async; returns immediately.

IsInitialized

Read-only bool. True if Init has completed successfully.

CurrentSessionId

Read-only string. Cross-reference with your own logs.

Sessions

SetSessionContext(Dictionary<string, string> context)

Starts a new session with the given metadata. Call once per match.

Traced.SetSessionContext(new Dictionary<string, string> {
  { "map", "arena_01" },
  { "mode", "deathmatch" },
});

Event tracking

TrackEvent(string eventId, Vector3 position)

TrackEvent(string eventId, Vector3 position, Quaternion rotation)

TrackEvent(string eventId, Vector3 position, Dictionary<string, string> metadata)

TrackEvent(string eventId, Vector3 position, Quaternion rotation, Dictionary<string, string> metadata)

Point or Oriented shape. With rotation, it's Oriented; without, Point.

TrackPair(string eventId, Vector3 from, Vector3 to, Dictionary<string, string> metadata = null)

Pair shape — two endpoints. Renders as a line segment.

TrackVolume(string eventId, Vector3 center, float radius, Dictionary<string, string> metadata = null)

Volume shape — sphere of influence. radius must be > 0.

TrackFrustum(string eventId, Vector3 position, Quaternion rotation, float fov, float range = 0f, Dictionary<string, string> metadata = null)

Frustum shape — view cone. fov in degrees, must be in (0, 180).

TrackEventWithTrail(string eventId, Vector3 position, string playerId, Dictionary<string, string> metadata = null)

Point flagged for trail linkage. The dashboard joins to preceding position samples.

Position streams (Pro+ tier)

TrackPosition(string playerId, Vector3 position)

TrackPosition(string playerId, Vector3 position, Quaternion rotation)

TrackPosition(string playerId, Vector3 position, Quaternion rotation, Vector3 velocity)

Call every frame (or every fixed step). Rate-limited client-side to MaxPositionSamplesPerSecond (default 10/sec).

Preset helpers

Wrapped under Traced.TracedPresets:

  • Death(position, rotation?, killerWeapon?, team?)
  • Kill(position, rotation?, victimId?, weapon?)
  • Spawn(position, rotation?, team?)
  • Pickup(position, itemType?)
  • ObjectiveComplete(position, objectiveId?)
  • DamageDealt(position, amount?, weapon?)
  • AreaEntered(position, areaName)
  • AreaExited(position, areaName)

Configuration

TracedConfig is a ScriptableObject. Tunable fields:

FieldDefaultPurpose
ApiKeysp_test_… or sp_live_…
ProjectIdUUID from dashboard
IngestUrlbackend URLOverride for self-host
RingBufferCapacity2048Max queued events
MaxEventsPerSecond100Client-side rate limit
MaxPositionSamplesPerSecond10Position stream rate
EnableOfflineQueuetrueDisk-backed retry on failed flush
OfflineQueueMaxBytes50MBCap on disk queue size
EnableInEditortrueFire events from Play mode
EnableDebugLogsfalseVerbose console output

Threading

All Track* methods must be called from the Unity main thread. Internal batching, gzip, and HTTP all run off the hot path via coroutines and background tasks.

Failure modes

The SDK fails silently if not initialized, if configuration is invalid, or if the network is unavailable. It will never throw, allocate excessively, or crash the game from within a Track call. Failed network sends persist to disk via OfflineQueue (default 50MB cap) and retry on next successful flush.