# 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](#create-a-new-local-project)
* [Install a package to a local project](#install-a-package-to-a-local-project)
* [Download an asset from the Asset Store](#download-an-asset-from-the-asset-store)
* [Create a new project and install a package](#create-a-new-project-and-install-a-package)

Alternatively, you can define your own [custom deeplink operation](#forward-a-custom-deeplink) using the [`DeeplinkHandler` attribute](https://docs.unity3d.com/6000.3/Documentation/ScriptReference/DeeplinkHandlerAttribute-ctor.html).

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](https://unity.com/download)
* [Unity Editor 6.3 or higher](https://unity.com/download)

## 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:

```html
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.

```html
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:

```html
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.

```html
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:

```html
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.

```html
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](https://docs.unity3d.com/6000.3/Documentation/ScriptReference/DeeplinkHandlerAttribute-ctor.html).

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:

```html
https://link.unity.com/hub/editor/{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:

```html
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:

```shell title="macOS"
open unityhub://editor/project/new
```

```shell title="Windows"
start "" unityhub://editor/project/new
```

```shell title="Linux"
xdg-open unityhub://editor/project/new
```

### Unity Editor C# usage

You can invoke a deeplinking operation from within a Unity C# script using the [`Application.OpenURL`](https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Application.OpenURL.html) 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:

```shell
Application.OpenURL("unityhub://editor/project/new");
```
