Deeplinking support for local projects
Starting in Unity Hub 3.15 and working with local projects created with Unity Editor 6.3 and up, the Unity Hub supports a wide range of deeplinking operations related to local projects.
読み終わるまでの所要時間 3 分最終更新 5ヶ月前
The following common operations are available as predefined deeplink targets via the Hub:
- Create a new local project
- Install a package to a local project
- Download an asset from the Asset Store
- Create a new project and install a package
Alternatively, you can define your own custom deeplink operation using the attribute.
DeeplinkHandlerDeeplinks are forwarded to the Unity Hub, which then forwards the link to the selected local project. The user doesn't need to have the Hub open prior to accessing the deeplink.
Requirements
To successfully open deeplinks, the user must have the following versions installed:
Unity Hub redirection pages
Using a Unity Hub redirection page is the recommended way to deliver a deeplink to the Unity Hub. Using a redirection URL makes sure that users receive fallback options in case the Unity Hub isn't installed, or if no installed Unity Editor supports the intended deeplinking operation.
If you don't want to use the redirection URL with fallback options, then replace with in the URL.
https://link.unity.com/hub/unityhub://editor/Create a new local project
To activate the Unity Hub and open to the Create New Project page, use the following URL:
https://link.unity.com/hub/project/new
Install a package to a local project
You can use deeplinking to directly open the Package Manager window within a project. The deeplink selects the specified package name and version, ready for installation.
https://link.unity.com/hub/package-manager/install/{package-and-version}
When the link is forwarded, the Hub displays the local projects list. The user must select the local project they want to open. When the project opens, the Package Manager window opens automatically.
If your local project is connected to the cloud, you can use the following URL to directly open a specific local project:
https://link.unity.com/hub/project/{cloud-project-id}/package-manager/install/{package-and-version}
where is the project ID found in the Settings page of the Unity Dashboard.
{cloud-project-id}Download an asset from the Asset Store
You can use deeplinking to access assets from the Asset Store via the Package Manager. The deeplink opens the Package Manager window with the specified asset from the Asset Store selected, ready for download.
https://link.unity.com/hub/package-manager/download/{asset-store-id}
When the link is forwarded, the Hub displays the local projects list. The user must select the local project they want to open. When the project opens, the Package Manager window opens automatically.
If your local project is connected to the cloud, you can use the following URL to directly open a specific local project:
https://link.unity.com/hub/project/{cloud-project-id}/package-manager/download/{asset-store-id}
where is the project ID found in the Settings page of the Unity Dashboard.
{cloud-project-id}Create a new project and install a package
Use the following URL format to create a new local project and use the deeplink operation to open the Package Manager when the new local project opens in the Unity Editor.
package-manager/installhttps://link.unity.com/hub/project/new/package-manager/install/{package-and-version}
Forward a custom deeplink
You can define a custom action to take when forwarding a deeplink to a local project using the attribute.
DeeplinkHandlerWrite a method that acts as a deeplink handler and defines the action that you want to take when the project is activated in the Editor. Use the attribute to decorate the handler method. When the project is activated, the deeplink is forwarded to the handler and the method executes.
DeepLinkHandlerUse the following URL format:
https://link.unity.com/hub/editor/{handler-namespace}/*
where specifies the namespace of the handler method and specifies any additional custom route segments and query parameters.
{handler-namespace}*If your local project is connected to the cloud, you can use the following URL format to forward the link directly to a specific local project:
https://link.unity.com/hub/project/{cloud-project-id}/{handler-namespace}/*
where is the project ID found in the Settings page of the Unity Dashboard.
{cloud-project-id}Invoke URL from script
You can trigger a deeplinking operation from the command line or any scripting environment that can invoke the opening of a URL.
If you're running in an offline context or you can be certain that the Unity Hub is present on the target device, then use the non-redirection URL format of .
unityhub://Command Line example usage
As an example, to activate the Unity Hub and display the Create New Project interface from shell scripting, use the following commands:
open unityhub://editor/project/new
Unity Editor C# usage
You can invoke a deeplinking operation from within a Unity C# script using the method.
Application.OpenURLAs an example, to activate the Unity Hub and display the Create New Project page from a Unity C# script, use the following statement:
Application.OpenURL("unityhub://editor/project/new");