Getting started with Unity

This guide explains how to install and use the official Indigauge Unity SDK in a Unity project.

The Unity SDK gives you session tracking, structured event logging, session metadata, heartbeats, crash reporting, screenshot capture, and an in-game feedback panel built on top of UI Toolkit.

For a complete playable reference, open the example project in the C# SDK repository.

Requirements

  • Unity 2022.3 or newer
  • Git installed and available on your PATH
  • An Indigauge project public key
  • Access to the C# SDK repository

Use the public key for the game you want to track. The key is safe to ship in a client build because it only identifies the game for ingest.

Install the SDK

Install with Unity Package Manager

  1. In Unity, open Window > Package Manager.
  2. Select + > Add package from git URL.
  3. Paste this URL and select Add:
https://github.com/Indigauge/sdk-csharp.git?path=/src/Indigauge.Unity#main

Alternatively, add this entry inside the existing dependencies object in your project's Packages/manifest.json:

{
  "dependencies": {
    "com.indigauge.unity": "https://github.com/Indigauge/sdk-csharp.git?path=/src/Indigauge.Unity#main"
  }
}

Keep your other dependency entries. The package includes the compiled .NET Standard 2.1 Core library, its runtime dependencies, Unity scripts, and all feedback panel resources. You do not need NuGet, a .NET SDK, manual DLL copying, or a manually created UIDocument.

Repository access

The SDK repository is currently private. Installation requires GitHub access and Git authentication configured on your machine. A public repository can be installed without authentication. See Unity's Git authentication guidance.

If your game scripts use an assembly definition, add a reference to Indigauge.Unity.

Then add an empty GameObject to your first scene and attach the Indigauge Behaviour (IndigaugeBehaviour) component.

TIP

Keep the IndigaugeBehaviour object in your startup scene. The component marks itself with DontDestroyOnLoad, so one instance can own telemetry across scene changes.

Migrate from a manual installation

Before installing the package, remove the old Assets/Indigauge/Runtime scripts and resources and the SDK DLLs you previously copied into your project. Do not keep an old Indigauge.Unity.dll or duplicate Core/dependency DLLs alongside the package. Check whether another plugin shares a dependency before removing it.

Pin and upgrade the package

For production, replace #main in the Git URL with a published release tag or commit hash. To upgrade a pinned installation, update that revision through Package Manager or the project manifest.

Unity locks Git dependencies. Simply reopening the project does not fetch new commits from main.

Platform support

WebGL is not currently supported by the SDK's background worker/networking architecture.

When using managed code stripping or IL2CPP, preserve members of your own event-property and feedback-context types that are serialized through reflection. The package's linker configuration preserves Core's models, not arbitrary game types.

Configure the component

Select the GameObject with IndigaugeBehaviour and fill the Inspector fields:

FieldDescription
Endpoint Base UrlIngest API URL. Use the default for production
Api KeyIndigauge project public key
Game IdGame name sent with session startup
Build IdGame or build version sent with session startup
ModeRuntime telemetry mode
Enable Panic HookSends unhandled exceptions as crash events by default
Enable Disk QueuePersists queued work locally when configured
Disk Queue PathRequired when disk queueing is enabled

IndigaugeBehaviour creates the client and starts a session automatically in Start(). Live session startup is asynchronous.

You can also configure it from code before Start() runs:

TelemetryBootstrap.cs
using Indigauge.Core.Public;
using Indigauge.Unity.Runtime;
using UnityEngine;

public sealed class TelemetryBootstrap : MonoBehaviour
{
    [SerializeField] private IndigaugeBehaviour indigauge;

    private void Awake()
    {
        indigauge.Configure(
            "YOUR_PUBLIC_KEY",
            "My Game",
            Application.version,
            IndigaugeMode.Auto);
    }
}

Pass IndigaugeMode.Auto explicitly when configuring from code: unlike the Inspector default, Configure() defaults to Live when its mode argument is omitted. Call it before IndigaugeBehaviour.Start(); it does not reconfigure an already-created client.

Runtime modes

Auto is the recommended default. It resolves to Dev in the Unity editor and Live in player builds.

ModeBehaviorUse it for
AutoUses Dev in the editor and Live outside the editorNormal projects
DevStarts a local session and logs activity without network sendsLocal testing
LiveSends sessions, events, heartbeats, metadata, feedback, and crashesProduction and live QA
DisabledSkips telemetry workOpt-out, privacy toggles, internal builds
NOTE

If dashboard data does not appear while testing in the editor, check the mode first. Auto intentionally uses local Devmode inside the Unity editor.

Send events

Events are queued after a session starts and flushed automatically. In Dev mode, events are logged locally instead of sent to the API.

Call the static helpers only after IndigaugeBehaviour.Start() has created the client. The component has a late execution order, so another component's Awake() or default-order Start() is too early for event or metadata calls; calls made before client creation are ignored.

Use the static helpers when you want global access:

using Indigauge.Unity.Runtime;

IndigaugeBehaviour.IgInfo("game.start");
IndigaugeBehaviour.IgInfo("player.jump", new { height = 2.4f });
IndigaugeBehaviour.IgWarn("network.retry", new { attempt = 2 });
IndigaugeBehaviour.IgError("save.failed", new { reason = "disk_full" });

If you prefer to keep telemetry in one gameplay component, wrap those static helpers in methods that match your own game events:

using Indigauge.Unity.Runtime;
using UnityEngine;

public sealed class PlayerTelemetry : MonoBehaviour
{
    public void OnJump(float height)
    {
        IndigaugeBehaviour.IgInfo("player.jump", new { height });
    }
}

Event names must follow the same format as the other SDKs:

  • Use exactly one dot: namespace.event.
  • Use only ASCII letters on both sides of the dot.
  • Do not use numbers, underscores, spaces, or multiple dots.
  • Put dynamic values in metadata, not the event name.

Good event names:

game.start
player.jump
level.clear
ui.open

Invalid event names:

game_start
level.3.clear
ui.button.click
store.purchase1

See the Event Naming guide for more detail.

Track session metadata

Session metadata describes the whole play session. Use it for state that you want to inspect alongside sessions and events, such as score, level, difficulty, region, build channel, character class, matchmaking mode, or experiment assignment.

IndigaugeBehaviour.SetSessionMetadata(new
{
    difficulty = "hard",
    region = "eu",
});

IndigaugeBehaviour.SetSessionMetadataValue("character", "ranger");
IndigaugeBehaviour.UpdateSessionMetadata(new
{
    level = 3,
    matchmaking = "ranked",
});
IndigaugeBehaviour.RemoveSessionMetadataValue("region");

When a session is active, metadata changes are sent with the next flush or as soon as the client can send them. In Dev mode, the update is logged locally.

Collect player feedback

The Unity adapter includes a feedback panel. You can open it from your own UI, input handling, or QA shortcut:

using Indigauge.Unity.Runtime;
using UnityEngine;

public sealed class FeedbackShortcut : MonoBehaviour
{
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            IndigaugeBehaviour.ToggleFeedbackPanel(new
            {
                scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name,
                frame = Time.frameCount,
            });
        }
    }
}

The built-in panel supports a message field, category selection, optional screenshot upload, custom labels, custom colors, and a context provider. Its assets are included in the package; do not copy them into Assets.

The panel requires a message and preserves the draft if submission fails. Players can close it with Cancel, X, or Escape. When attaching a screenshot, the built-in flow hides the panel and waits for a rendered game frame before capturing it.

Set a context provider when you want feedback to include current game state:

IndigaugeBehaviour.SetFeedbackContextProvider(() => new
{
    score,
    level,
    remainingEnemies,
    state,
});

Customize the built-in panel before opening it:

IndigaugeBehaviour.SetFeedbackPanelOptions(new IndigaugeFeedbackPanelOptions
{
    Title = "Send playtest feedback",
    MessageLabel = "What happened?",
    DefaultCategory = "General",
    IncludeScreenshotByDefault = true,
    PanelRect = new Rect(0f, 0f, 600f, 0f),
});

The UI Toolkit panel is centered. PanelRect.width sets its preferred width; a positive height sets its preferred height, and zero fits the content. The x/y coordinates are unused. The panel is constrained to the viewport and scrolls vertically on smaller screens.

Set panel options and the context provider after the component's Awake() has registered its instance. A context passed to ShowFeedbackPanel() or ToggleFeedbackPanel() takes precedence over the provider.

To submit feedback directly:

using System.Collections.Generic;
using Indigauge.Core.Public.Models;
using Indigauge.Unity.Runtime;

await IndigaugeBehaviour.SubmitFeedbackAsync(new FeedbackRequest
{
    Message = "The jump timing feels inconsistent.",
    Category = "gameplay",
    Context = new { level = 3 },
    Attachments = new List<FeedbackAttachment>
    {
        new()
        {
            FileName = "feedback-screenshot.png",
            ContentType = "image/png",
            Data = IndigaugeBehaviour.CapturePng(),
        },
    },
});

SubmitFeedbackAsync() queues feedback for the background sender; completion does not confirm server delivery. CapturePng() uses Unity APIs and must run on the main thread. For custom screenshot flows, capture after the frame has rendered and hide any UI you do not want included; the built-in panel handles this sequencing for you.

Accepted feedback categories are:

bugs, general, ui, performance, gameplay, controls, audio, balance,
graphics, visual, art, other

Unknown or empty categories are sent as other.

Crash reporting

Enable Panic Hook is on by default. When an unhandled exception reaches the SDK hook, Indigauge queues a game.crash event with exception type, message, stack trace, thread id, timestamp, and fatal flag.

You can disable or enable the hook at runtime:

IndigaugeBehaviour.DisablePanicHook();
IndigaugeBehaviour.EnablePanicHook();

The hook listens for global unhandled exceptions and unobserved task exceptions; do not assume every error logged to the Unity Console reaches it. Hard process crashes cannot guarantee delivery. On application quit, the adapter requests session end and attempts a background flush and disposal, but process termination can interrupt that work. Keep crash metadata free of secrets or personally identifying information.

Configuration reference

IndigaugeBehaviour creates an IndigaugeClient with these defaults:

OptionDefaultDescription
EndpointBaseUrlhttps://ingest.indigauge.comIngest API URL
SdkVersionunity:1.0.0SDK identifier sent with requests
ModeAutoResolves to Dev in editor, Live in builds
EnablePanicHooktrueRegisters global unhandled-exception handling
EnableDiskQueuefalseEnables local persistence for queued work
MaxBatchSize64Maximum events sent per batch
MaxBatchDelay10sMaximum delay before flushing a partial batch
MaxAttempts5Retry attempts for send failures
BaseBackoff500msInitial retry backoff
SessionHeartbeatInterval30sHeartbeat interval for active live sessions

Batching, retry, and heartbeat settings are Core defaults, not additional Inspector fields or arguments to Configure().

API reference

Startup

indigauge.Configure(apiKey, gameName, gameVersion, mode, endpointBaseUrl);

IndigaugeBehaviour starts automatically in Start().

Events

IndigaugeBehaviour.IgTrace(eventName, properties = null);
IndigaugeBehaviour.IgDebug(eventName, properties = null);
IndigaugeBehaviour.IgInfo(eventName, properties = null);
IndigaugeBehaviour.IgWarn(eventName, properties = null);
IndigaugeBehaviour.IgError(eventName, properties = null);

Session metadata

IndigaugeBehaviour.SetSessionMetadata(metadata);
IndigaugeBehaviour.UpdateSessionMetadata(metadata);
IndigaugeBehaviour.SetSessionMetadataValue(key, value);
IndigaugeBehaviour.RemoveSessionMetadataValue(key);

Feedback

IndigaugeBehaviour.ShowFeedbackPanel(context = null);
IndigaugeBehaviour.HideFeedbackPanel();
IndigaugeBehaviour.ToggleFeedbackPanel(context = null);
IndigaugeBehaviour.IsFeedbackPanelVisible();
IndigaugeBehaviour.SetFeedbackPanelOptions(options);
IndigaugeBehaviour.SetFeedbackContextProvider(contextProvider);
IndigaugeBehaviour.SubmitFeedbackAsync(request);
IndigaugeBehaviour.CapturePng();

Crash reporting

IndigaugeBehaviour.EnablePanicHook();
IndigaugeBehaviour.DisablePanicHook();

Example project

The repository includes a playable Unity Breakout sample. Unlike Package Manager installation, this source-based sample uses an export script and requires a .NET SDK and PowerShell.

  1. Clone the C# SDK repository and, from its root, build and copy the SDK assemblies and runtime resources:

    powershell -ExecutionPolicy Bypass -File .\samples\UnitySample\tools\Export-UnitySamplePlugins.ps1
    
  2. Open sdk-csharp/samples/UnitySample in Unity Hub.

  3. Open Assets/Scenes/Breakout.unity.

  4. Select the IndigaugeBreakout GameObject.

  5. Fill Endpoint Base Url, Api Key, Game Name, Game Version, and Mode.

  6. Enter Play Mode.

  7. Press F or use the HUD feedback button to test the feedback panel.

Use Live explicitly to see sample data in the dashboard while in the editor. Do not add the UPM package on top of the sample's copied runtime files and DLLs.

The sample records session metadata and these events:

game.start
ball.launch
brick.hit
level.clear
life.lost
game.over
ui.feedback

Production checklist

  • Set a real Api Key.
  • Use a stable Game Id and Build Id.
  • Pin the package to a release tag or commit hash.
  • Leave Mode as Auto unless you need to force a specific mode.
  • Keep event names stable across releases.
  • Send dynamic values as metadata, not as event names.
  • Verify a release-like build in Live mode before shipping.
  • Test the feedback panel with your input map, UI Toolkit setup, and scene loading flow.
  • Test serialized game metadata and feedback context in a release build with your actual managed stripping/IL2CPP settings.
  • Avoid putting personally identifiable information in event, feedback, or crash metadata.

Troubleshooting

Package Manager cannot install the SDK

  • Confirm Git is installed and available on the PATH used by Unity.
  • Use the full Git URL, including ?path=/src/Indigauge.Unity before the revision fragment.
  • For a private repository, confirm your GitHub access and Git credentials.
  • Confirm the selected branch, tag, or commit contains the Unity package.

Duplicate assembly or type errors after upgrading

  • Remove old manually copied SDK scripts and DLLs before using the package.
  • Check for duplicate dependency DLLs from other plugins before deleting shared files.
  • If scripts with an assembly definition cannot find the adapter, add a reference to Indigauge.Unity.

No data appears in Indigauge

  • Confirm the build is running in Live mode. Auto is local Dev mode in the Unity editor.
  • Confirm Api Key, Game Id, and Build Id are set before IndigaugeBehaviour.Start() runs.
  • Check the Unity Console for SDK validation or session startup errors.

Events are not sent

  • Events are queued only after a session has started.
  • Do not send events from another component's Awake() or default-order Start() before the SDK client exists.
  • Event names must use the strict namespace.event format.
  • Event names can only contain letters and one dot.
  • In Dev mode, events are logged locally instead of sent to the API.

The feedback panel does not open

  • Confirm an initialized IndigaugeBehaviour object exists, including one preserved from your startup scene.
  • For a UPM installation, confirm the package's Runtime/Resources assets are present. You do not need an Assets/Indigauge/Runtime/Resources copy.
  • For the source-based sample, rerun its export script to sync resources.
  • Check the Unity Console for missing UXML or IndigaugePanelSettings errors.
  • Call IndigaugeBehaviour.ShowFeedbackPanel() directly to verify the panel loads.

The feedback panel appears behind other UI

  • Keep the package's built-in IndigaugePanelSettings.asset and theme with its runtime resources.
  • Check your HUD's canvas and panel sorting settings. The SDK uses sorting order 32767 for its feedback UI; custom UI can still obscure it depending on its own rendering setup.