varcomponents=newFirebase.DynamicLinks.DynamicLinkComponents(// The base Link.newSystem.Uri("https://www.example.com/"),// The dynamic link URI prefix."https://example.page.link"){IOSParameters=newFirebase.DynamicLinks.IOSParameters("com.example.ios"),AndroidParameters=newFirebase.DynamicLinks.AndroidParameters("com.example.android.package_name"),};// do something with: components.LongDynamicLink
varoptions=newFirebase.DynamicLinks.DynamicLinkOptions{PathLength=DynamicLinkPathLength.Unguessable};Firebase.DynamicLinks.DynamicLinks.GetShortLinkAsync(components,options).ContinueWith(task=>{if(task.IsCanceled){Debug.LogError("GetShortLinkAsync was canceled.");return;}if(task.IsFaulted){Debug.LogError("GetShortLinkAsync encountered an error: "+task.Exception);return;}// Short Link has been created.Firebase.DynamicLinks.ShortDynamicLinklink=task.Result;Debug.LogFormat("Generated short link {0}",link.Url);varwarnings=newSystem.Collections.Generic.List<string>(link.Warnings);if(warnings.Count > 0){// Debug logging for warnings generating the short link.}});
[null,null,["上次更新時間:2025-08-08 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\n| **Deprecated:** Firebase Dynamic Links is *deprecated* and should not be adopted in projects that don't already use it. The service will shut down on August 25, 2025. See the [Dynamic Links Deprecation FAQ](/support/dynamic-links-faq) for more information.\n\nYou can create short or long Dynamic Links with the Firebase Dynamic Links API. The API\ntakes several optional parameter structures to build links. Short links can\nalso be created from a previously generated long link. The Dynamic Links API\nwill generate a URL like the following: \n\n https://example.page.link/aSDf\n\nBefore you begin\n\nBefore you can use\n[Firebase Dynamic Links](/docs/reference/unity/namespace/firebase/dynamic-links),\nyou need to:\n\n- Register your Unity project and configure it to use Firebase.\n\n - If your Unity project already uses Firebase, then it's already\n registered and configured for Firebase.\n\n - If you don't have a Unity project, you can download a\n [sample app](//github.com/google/mechahamster).\n\n- Add the [Firebase Unity SDK](/download/unity) (specifically, `FirebaseDynamicLinks.unitypackage`) to\n your Unity project.\n\n| **Find detailed instructions for these initial\n| setup tasks in\n| [Add Firebase to your Unity project](/docs/unity/setup#prerequisites).**\n\nNote that adding Firebase to your Unity project involves tasks both in the\n[Firebase console](//console.firebase.google.com/) and in your open Unity project\n(for example, you download Firebase config files from the console, then move\nthem into your Unity project).\n| **Note:** Dynamic Links is not supported on tvOS.\n\nSet a Dynamic Links URI prefix\n\n1. In the Firebase console, open the **Dynamic Links** section.\n\n2. If you have not already accepted the terms of service and set a URI prefix for\n your Dynamic Links, do so when prompted.\n\n If you already have a Dynamic Links URI prefix, take note of it. You need to\n provide a Dynamic Links URI prefix when you programmatically create Dynamic Links.\n\n3. **Recommended** : Specify the URL patterns allowed in your deep links and\n fallback links. By doing so, you prevent unauthorized parties from\n creating Dynamic Links that redirect from your domain to sites you don't\n control. See\n [Allow specific URL patterns](/docs/dynamic-links/allow-specific-url-patterns).\n\nUse the Firebase console\n\nIf you want to generate a single Dynamic Link, either for testing purposes, or for your marketing team\nto easily create a link that can be used in something like a social media post, the simplest way would\nbe to visit the [Firebase console](https://console.firebase.google.com/project/_/durablelinks/links/)\nand create one manually following the step-by-step form.\n\nCustom domains\n\nYou can have greater control over your Dynamic Link's branding by using your own\ndomain instead of a `goo.gl` or `page.link` subdomain. Follow [these\ninstructions](/docs/dynamic-links/custom-domains) to set up a custom domain for\nyour project.\n| **Note:** If you're building your project for iOS, you must edit the `Info.plist` file per the [iOS-only instructions](/docs/dynamic-links/custom-domains#console) for setting up a custom domain.\n\nUsing the Firebase Dynamic Links API\n\nCreating a long Dynamic Link from parameters\n\nTo create a Dynamic Link, create a `DynamicLinkComponents` object, setting any\nof the optional members for additional configuration, and then access the\n`LongDynamicLink` property to get the link URL.\n\nThe following minimal example creates a long Dynamic Link to\nhttps://www.example.com/ that opens with your Android app\ncom.example.android on Android and the app com.example.ios on iOS: \n\n```c#\nvar components = new Firebase.DynamicLinks.DynamicLinkComponents(\n // The base Link.\n new System.Uri(\"https://www.example.com/\"),\n // The dynamic link URI prefix.\n \"https://example.page.link\") {\n IOSParameters = new Firebase.DynamicLinks.IOSParameters(\"com.example.ios\"),\n AndroidParameters = new Firebase.DynamicLinks.AndroidParameters(\n \"com.example.android.package_name\"),\n };\n// do something with: components.LongDynamicLink\n```\n| **Note:** Long links append all of the configuration settings as query arguments to the link and therefore do not require any network calls.\n\nCreating a short Dynamic Link\n\nTo create a short Dynamic Link, pass a previously generated long link to\n`Firebase.DynamicLinks.GetShortLinkAsync` or build `DynamicLinkComponents` in\nthe same way as above.\n\n`GetShortLinkAsync` optionally takes an extra `DynamicLinkOptions` config\nparameter with the `PathLength` property, allowing you to control how the link\nshould be generated. Short link generation requires a network request to the\nFirebase backend, so the `GetShortLinkAsync` method is executed asynchronously.\n`GetShortLinkAsync` returns a `Task\u003cFirebase.DynamicLinks.ShortDynamicLink\u003e`.\n\nFor example: \n\n```c#\nvar options = new Firebase.DynamicLinks.DynamicLinkOptions {\n PathLength = DynamicLinkPathLength.Unguessable\n};\n\nFirebase.DynamicLinks.DynamicLinks.GetShortLinkAsync(components, options).ContinueWith(task =\u003e {\n if (task.IsCanceled) {\n Debug.LogError(\"GetShortLinkAsync was canceled.\");\n return;\n }\n if (task.IsFaulted) {\n Debug.LogError(\"GetShortLinkAsync encountered an error: \" + task.Exception);\n return;\n }\n\n // Short Link has been created.\n Firebase.DynamicLinks.ShortDynamicLink link = task.Result;\n Debug.LogFormat(\"Generated short link {0}\", link.Url);\n\n var warnings = new System.Collections.Generic.List\u003cstring\u003e(link.Warnings);\n if (warnings.Count \u003e 0) {\n // Debug logging for warnings generating the short link.\n }\n});\n```\n\nThe example above uses a lambda expression that is triggered when the task is\ncompleted."]]