docs.unity3d.com

    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.

    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 DeeplinkHandler attribute.

    Deeplinks 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 3.15 or higher
    • Unity Editor 6.3 or higher

    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 https://link.unity.com/hub/ with unityhub://editor/ in the URL.

    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 {cloud-project-id} is the project ID found in the Settings page of the Unity Dashboard.

    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 {cloud-project-id} is the project ID found in the Settings page of the Unity Dashboard.

    Create a new project and install a package

    Use the following URL format to create a new local project and use the package-manager/install deeplink operation to open the Package Manager when the new local project opens in the Unity Editor.

    https://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 DeeplinkHandler attribute.

    Write 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 DeepLinkHandler attribute to decorate the handler method. When the project is activated, the deeplink is forwarded to the handler and the method executes.

    Use the following URL format:

    https://link.unity.com/hub/{handler-namespace}/*
    

    where {handler-namespace} specifies the namespace of the handler method and * specifies any additional custom route segments and query parameters.

    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 {cloud-project-id} is the project ID found in the Settings page of the Unity Dashboard.

    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:

    macOS:

    open unityhub://editor/project/new
    

    Windows:

    start "" unityhub://editor/project/new
    

    Linux:

    xdg-open unityhub://editor/project/new
    

    Unity Editor C# Usage

    You can invoke a deeplinking operation from wtihin a Unity C# script using the Application.OpenURL method.

    As 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");
    
    Copyright © Unity Technologies
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX.