Unity SDK

Configuration

Every field on ReflectConfig, what it does, and what to set in development vs. release builds.

Minimum config

ReflectSDK.Initialize(new ReflectConfig {
    BaseUrl       = "https://reflect.bablu147147.workers.dev",
    CompanyKey    = "co_live_…",
    AppKey        = "app_live_…",
    SigningSecret = "<rotate-from-apps-settings>",
});

Field reference

FieldTypeDefaultNotes
BaseUrlstring?nullServer endpoint. Leave empty for debug mode (no network, overlay still works).
CompanyKeystringRequired when BaseUrl is set. Find at Settings in the admin panel.
AppKeystringRequired when BaseUrl is set. Per-app, find at Apps.
SigningSecretstringRequired when BaseUrl is set. Never commit.
EnableLoggingboolfalseVerbose Unity console logs. Gate on Debug.isDebugBuild.
AutoSessionTrackingbooltrueAuto-fire app_open / session_start / session_end.
AutoCaptureCrashesbooltrueAuto-fire _crash on unhandled exceptions. Throttled to 1/min.
BatchSizeint50Events per HTTP batch.
MaxQueueSizeint1000Max events held offline. Oldest dropped past this.
FlushIntervalSecondsfloat30Time-based flush trigger.
RequireAdvertisingConsentboolfalseBlock GAID/IDFA collection until SetAdvertisingConsent(true). Recommended for EU.
AutoRequestIosTrackingboolfalseAuto-prompt ATT on iOS first launch. False = call RequestIosTracking() yourself when ready.
EnableDebugOverlayboolfalseShow the floating R button even when a real BaseUrl is set. Always gate on Debug.isDebugBuild.

Debug mode

Pass BaseUrl = null (or omit it) to run the SDK locally with the developer overlay but no network requests. Useful for:

  • Learning what the SDK collects without setting up a server
  • Verifying integration in CI / playmode tests
  • Demoing the SDK without exposing your prod keys
ReflectSDK.Initialize(new ReflectConfig {
    // No BaseUrl, no keys → debug mode.
    EnableLogging = true,
});

A red banner appears in-game and the floating R button opens the inspector. See Debug overlay.

Inspection mode

To run with a real BaseUrl AND keep the overlay visible:

new ReflectConfig {
    BaseUrl            = "https://...",
    CompanyKey         = "...",
    AppKey             = "...",
    SigningSecret      = "...",
    EnableDebugOverlay = Debug.isDebugBuild,   // ← gate this!
}
Don’t leave the overlay on in release builds.
Banner colour switches to amber so you notice, but always gate on Debug.isDebugBuild just in case.

Keeping secrets out of source

  • Build-time injection — read from an env var in a Custom Build script:
    var secret = Environment.GetEnvironmentVariable("REFLECT_SIGNING_SECRET");
  • ScriptableObject ignored from git — store keys in a SO that lives outside source control; load via Resources.Load.
  • Server-side rotation — admin panel → Apps → Settings → Rotate signing secret. SDK will start failing HMAC verification within minutes; ship a new build before rotating in production.