Skip to content

Unity SDK

Install via Unity Package Manager from the Flinku Git repository.

Installation (UPM)

In Unity: Window → Package Manager → + → Add package from git URL

text
https://github.com/flinku-dev/unity-sdk.git

Setup

csharp
FlinkuSDK.Initialize(new FlinkuConfig {
    BaseUrl = "https://yourapp.flku.dev"
});

Match() with callback

csharp
FlinkuSDK.Match((result) => {
    if (result.Matched && !string.IsNullOrEmpty(result.DeepLink)) {
        // Open scene or deep link URI
    }
});
csharp
FlinkuSDK.CreateLink(new FlinkuLinkOptions {
    Title = "Summer Campaign",
    DeepLink = "yourapp://promo",
    ApiKey = "flk_live_your_api_key"
}, (link, error) => {
    if (error != null) Debug.LogError(error);
    else Debug.Log(link.ShortUrl);
});

C# example

csharp
using UnityEngine;

public class FlinkuBootstrap : MonoBehaviour
{
    void Start()
    {
        FlinkuSDK.Initialize(new FlinkuConfig { BaseUrl = "https://yourapp.flku.dev" });

        FlinkuSDK.Match((m) =>
        {
            if (m.Matched)
                Debug.Log($"Deferred: {m.DeepLink}");
        });
    }

    public void OnSharePressed()
    {
        FlinkuSDK.CreateLink(
            new FlinkuLinkOptions
            {
                Title = "Invite",
                DeepLink = "mygame://lobby",
                ApiKey = System.Environment.GetEnvironmentVariable("FLINKU_API_KEY")
            },
            (link, err) =>
            {
                if (err != null) { Debug.LogError(err); return; }
                Debug.Log(link.ShortUrl);
            });
    }
}

The modern Firebase Dynamic Links replacement.