Skip to content

LocusVia

Technical documentation

Unity SDK

Resolve public links and send attributed outcomes with Unity coroutines.

Choose this SDK when#

Use the Unity SDK for games or interactive applications built with Unity 2021.3 or later where a MonoBehaviour owns link routing.

Warning

Version 0.1.3 is source-only. Unity Editor compilation and signed-device opening are not yet published proof; pin evaluations to a reviewed commit SHA.

Choose another SDK when: your mobile shell is implemented outside Unity or you require a registry-published package. Route links in the owning native shell instead.

Before you start#

  • Unity 2021.3 or later and a reviewed LocusVia repository commit.
  • A LocusVia App Platform ID and environment-scoped SDK key.
  • A routing function that can translate the resolved pathname into a Unity scene or application state.

Note

Use an environment-scoped public SDK key. Never embed a server, admin, or privileged credential in an app.

1. Add the package#

In Unity Package Manager choose Add package from git URL. Pin the URL to the reviewed commit you tested.

text
https://github.com/NanFengCheong/locusvia.git?path=/sdk/unity#REVIEWED_COMMIT_SHA

2. Create the client#

Use the API origin, not the public link domain. Create one client and keep it with the application shell.

csharp
var client = new LocusViaClient(new LocusViaConfig(
    "REPLACE_WITH_APP_ID",
    "REPLACE_WITH_SDK_KEY",
    "https://staging.locusvia.com"));

3. Resolve and route#

Start the coroutine from a MonoBehaviour. Route only when the response contains a link pathname; keep failures visible in development logs.

csharp
StartCoroutine(client.ResolveShortLink(
    receivedUrl,
    result => {
        if (result.processed && result.link != null) Route(result.link.pathname);
    },
    Debug.LogWarning));

4. Track the outcome#

Use a stable event ID and an uppercase three-letter currency. Never sum or relabel different currencies in the client.

csharp
StartCoroutine(client.TrackOutcome(
    "purchase",
    19.99m,
    "USD",
    completed: response => Debug.Log(response.accepted),
    failed: Debug.LogWarning));

Verify the integration#

  1. Run the package EditMode tests for the reviewed source revision.
  2. Open a public link in an actual player build and confirm the expected scene or route receives the pathname.
  3. Send the same stable outcome event ID twice and confirm the server does not double-count it.

Warning

A successful build proves source compatibility only. Test a real link on the target browser or signed device before release.

Troubleshoot by symptom#

Package Manager cannot resolveConfirm the Git URL includes ?path=/sdk/unity and a commit that contains the package manifest.
HTTP request failsConfirm network permissions, the environment API origin, and the matching SDK key and app ID.
Callback has no linkCheck result.processed and the server error envelope before attempting to route.
Editor works but device does notVerify platform association files and test the signed player; editor success does not prove operating-system link delivery.

Next steps#

Confirm your domain associations, then add conversion and revenue events only after link resolution works end to end.

Was this page helpful?