Skip to content

Install the Unity SDK

Playtrace records selected gameplay replays from inside your Unity project. The SDK uses your project SDK key to fetch the active recording campaign, receive capture settings, and upload only the clips that match that campaign.

Prerequisites

  • Unity project targeting Windows or Android. The Unity Editor is supported for local testing.
  • A Playtrace account with a company and project created in the dashboard.
  • Access to the project SDK key from Project settings.

Add the SDK files

  1. Open your Unity project.
  2. Import the package using Assets > Import Package > Custom Package and select the SDK .unitypackage file.
  3. Wait for Unity to compile the project.

After the package is imported, you will see Playtrace folder in your Assets folder. Keep the imported SDK folder in source control unless your team manages SDKs through a package-management workflow.

Copy the SDK key

  1. Open the Playtrace dashboard.
  2. Select project for this game.
  3. Open Project settings.
  4. Copy the SDK key from the Unity SDK section.

The SDK key identifies the Playtrace project. It is not a user login token, but resetting it immediately disconnects builds that still use the old key.

Configure the runtime

Open Unity and go to Edit > Project Settings > Playtrace and paste the SDK key from the project settings page.

Create a recording campaign

The SDK records only when a matching campaign is active.

  1. In the dashboard, open the project.
  2. Create a recording campaign.
  3. Select the platforms your Unity build will report. For testing in Play Mode, make sure Editor is selected.
  4. Choose the start event, recording rule, upload rule, capture quality, and replay quota.
  5. Start the campaign.

If no active campaign matches the game session, the SDK stays idle and does not upload replays.

Emit gameplay events

Campaigns are driven by exact case-sensitive event names. Use stable, lowercase names and keep them consistent across builds.

csharp
PlaytraceEvents.Emit("tutorial_started");
PlaytraceEvents.Emit("tutorial_finished");

The SDK automatically emits game_paused and game_unpaused lifecycle events when supported by the current platform. Playtrace treats them like normal campaign events. Avoid manually emitting game_paused and game_unpaused on your own, as it can cause duplicate events.

Verify the setup

  1. Run the game in a build or Play Mode environment that reports a platform selected by the campaign.
  2. Trigger the campaign start event.
  3. Complete or fail the flow according to the campaign's upload rule.
  4. Open the campaign in the dashboard and check the replay list after processing finishes.

If no replay appears, check that the SDK key is current, the campaign is active, the platform filter matches, the start event name matches exactly, the recording qualified for upload, and the replay quota has not been reached.