Unity SDK

Attriax already exposes a Unity runtime track for scene-aware attribution and deep-link handling, but we still treat it as an in-development public integration surface.

SDK / Unity

This section stays intentionally general. For detailed configuration, project-specific diagnostics, release context, and exact disclosure guidance, open the app workspace for your project.

Package surface

General guide for Attriax Unity package. Use the app workspace when you need detailed setup steps, release context, and project-specific values.

The Unity package is not published to a public package registry yet. Use these public docs to evaluate the API shape, then create an app to see the current package release, notes, and download flow.

What teams use it for

These are the runtime jobs the product already exposes through the SDK and the matching workspace tools.

Scene-aware runtime

Keep attribution, app-open tracking, and scene context together in the engine lifecycle.

Validator-backed setup

Use the editor validator and setup diagnostics once the package is imported into a real project.

Maturing release track

Documented today, improving over time, and best paired with the app workspace for current release details.

Integration notes

Keep the public docs lightweight, then open the app workspace when you need the exact setup steps for your own release flow.

Capabilities

  • Initialize from configured settings or bootstrap a host dynamically when you need a code-first setup path.
  • Subscribe to deep-link events and resolve destinations after the runtime finishes app-open processing.
  • Track scene or gameplay context as runtime events so attribution stays connected to in-game behavior.
  • Run editor-side validation after import to confirm token and host resolution during setup.

Notes

  • Unity is publicly documented here, but the release track is still maturing compared with Flutter and web.
  • Unity Editor and desktop players do not register uninstall tokens directly, so token bridges should stay behind mobile runtime checks.
  • Create an app to access the current package release details, notes, and validator workflow from the signed-in setup surface.

Distribution

The Unity package is not published to a public package registry yet. Use these public docs to evaluate the API shape, then create an app to see the current package release, notes, and download flow.

Example

The snippet below mirrors the app workspace starting point while keeping the guide general instead of project-specific.

Assets/Scripts/AttriaxBootstrap.cs

Initialize the runtime, subscribe to deep links, track scene context, and hand resolved destinations back to your game flow.

1#nullable enable
2using System;
3using System.Collections.Generic;
4using System.Threading.Tasks;
5using Attriax.Unity;
6using UnityEngine;
7using UnityEngine.SceneManagement;
8
9public sealed class AttriaxBootstrap : MonoBehaviour
10{
11  private Attriax? _attriax;
12  private IDisposable? _deepLinkSubscription;
13
14  private async void Start()
15  {
16    if (Attriax.HasConfiguredSettings)
17    {
18      _attriax = await Attriax.InitializeConfiguredAsync();
19    }
20    else
21    {
22      var host = await AttriaxBehaviour.CreateAndInitializeHostAsync(
23        new AttriaxConfig
24        {
25          AppToken = "ax_your_app_token",
26          EnableDebugLogs = Debug.isDebugBuild,
27          AutomaticSceneTracking = true,
28          SdkMetadata = new Dictionary<string, object>
29          {
30            ["environment"] = Application.platform.ToString(),
31          },
32        },
33        new AttriaxInitOptions
34        {
35          TrackAppOpen = true,
36          CaptureInitialUrl = true,
37        },
38        persistAcrossScenes: true);
39
40      _attriax = host.Instance ?? throw new InvalidOperationException(
41        "Attriax host did not create an SDK instance.");
42    }
43
44    if (_attriax == null)
45    {
46      return;
47    }
48
49    _deepLinkSubscription = _attriax.DeepLinks.Stream.Subscribe(HandleDeepLinkEvent);
50
51    var appOpen = await _attriax.WaitForAppOpenTrackingAsync();
52    if (appOpen?.IsFirstLaunch == true)
53    {
54      Debug.Log("[Attriax] First launch tracked.");
55    }
56
57    if (!string.IsNullOrWhiteSpace(appOpen?.DeepLink?.Path))
58    {
59      OpenDeepLink(appOpen.DeepLink.Path);
60    }
61
62    await _attriax.TrackEventAsync("session_started", new AttriaxTrackEventOptions
63    {
64      EventData = new Dictionary<string, object>
65      {
66        ["scene"] = SceneManager.GetActiveScene().name,
67      },
68    });
69
70    // Forward mobile uninstall tokens from your native bridge after the SDK is ready.
71    // Example hooks:
72    // NativePushBridge.FirebaseTokenReceived += token => _ = RegisterFirebaseTokenAsync(token);
73    // NativePushBridge.ApplePushTokenReceived += token => _ = RegisterApplePushTokenAsync(token);
74  }
75
76  private void OnDestroy()
77  {
78    _deepLinkSubscription?.Dispose();
79  }
80
81  private void HandleDeepLinkEvent(AttriaxDeepLinkEvent deepLinkEvent)
82  {
83    _ = ResolveDeepLinkAsync(deepLinkEvent);
84  }
85
86  private async Task ResolveDeepLinkAsync(AttriaxDeepLinkEvent deepLinkEvent)
87  {
88    var result = await deepLinkEvent.ResolveAsync();
89    var resolution = result.Resolution;
90    if (!result.IsMatched || resolution?.DeepLink == null)
91    {
92      return;
93    }
94
95    OpenDeepLink(resolution.DeepLink.Path);
96  }
97
98  public async Task RegisterFirebaseTokenAsync(string? token)
99  {
100    if (_attriax == null)
101    {
102      return;
103    }
104
105    await _attriax.RegisterFirebaseMessagingTokenAsync(
106      token,
107      new Dictionary<string, object>
108      {
109        ["provider"] = "fcm",
110        ["platform"] = Application.platform.ToString(),
111      });
112  }
113
114  public async Task RegisterApplePushTokenAsync(string? token)
115  {
116    if (_attriax == null)
117    {
118      return;
119    }
120
121    await _attriax.RegisterApplePushTokenAsync(
122      token,
123      new Dictionary<string, object>
124      {
125        ["provider"] = "apns",
126        ["platform"] = Application.platform.ToString(),
127      });
128  }
129
130  private void OpenDeepLink(string path)
131  {
132    Debug.Log(
quot;[Attriax] Navigate to:
{path}");
133 // Map the Attriax path to your scene, router, or gameplay flow. 134 } 135}