前往主控台

Receive Dynamic Links with Unity

To receive the Firebase Dynamic Links that you created, you must include the Dynamic Links SDK in your app and register a listener to handle the DynamicLinkReceived event.

The Unity SDK works for both Android and iOS, with some additional setup required for each platform.

Before you begin

Before you can use Firebase Dynamic Links, you need to:

  • Register your Unity project and configure it to use Firebase.

    • If your Unity project already uses Firebase, then it's already registered and configured for Firebase.

    • If you don't have a Unity project, you can download a sample app.

  • Add the Firebase Unity SDK (specifically, FirebaseDynamicLinks.unitypackage) to your Unity project.

Note that adding Firebase to your Unity project involves tasks both in the Firebase console and in your open Unity project (for example, you download Firebase config files from the console, then move them into your Unity project).

Register to receive incoming Dynamic Links

To check for Dynamic Links, you need to register for the DynamicLinkReceived event.

void Start() {
  DynamicLinks.DynamicLinkReceived += OnDynamicLink;
}

// Display the dynamic link received by the application.
void OnDynamicLink(object sender, EventArgs args) {
  var dynamicLinkEventArgs = args as ReceivedDynamicLinkEventArgs;
  Debug.LogFormat("Received dynamic link {0}",
                  dynamicLinkEventArgs.ReceivedDynamicLink.Url.OriginalString);
}