Deeplinking
Last updated
Last updated
Deep linking allows your application to respond to external URLs and launch directly into specific content or actions within the app. This is particularly useful for experiences like loading user-specific avatars or jumping into a custom scene from a shared link. Our SDK supports deep linking across mobile platforms (Android and iOS) as well as desktop platforms (Windows and macOS). This guide will walk you through enabling and handling deep links in your Unity project using our SDK.
When it comes to sending avatars created in our PlayerZero web platform the simplest way to send them to a mobile application is by passing data via deep linking. Unity supports deeplinking and the steps described below can also be found in the Unity documentation here.
To enable deeplinking for Android you can use an intent filter. The process is as follows:
In Unity navigate to Edit > Project Settings > Player
In the Android settings tab, expand the Publishing Settings section
In the Build section, enable Custom Main Manifest. This creates a new file called AndroidManifest.xml
in Assets/Plugins/Android
.
In the Project window, go to Assets > Plugins > Android and open the AndroidManifest.xml
file
Add the following code sample inside the Unity<activity>
element, named com.unity3d.player.UnityPlayerGameActivity
or com.unity3d.player.UnityPlayerActivity
, and save the file.
Remember to replace the number 0000
in playerzero0000
with your unique GAMEID
to ensure you are using your own unique scheme.
To enable deeplinking for iOS it is even simpler, the process is as follows.
Go to Edit > Project Settings > Player > Other Settings > Configuration.
Expand Supported URL schemes to set the following properties:
Size property to 1
.
Element 0 property to the URL scheme to use with your application. For example, use playerzero0000
to open your application when the device processes a link that starts with playerzero0000://
.
Remember to replace the number 0000
in playerzero0000
with your unique GAMEID
to ensure you are using your own unique scheme.
Ensure that you have set your GameID by logging into the Player Zero Developer Window located in the tool bar Tools > Player Zero
In your first scene add an empty GameObject and add the component DesktopDeepLinkSetup.
If you look in the components inspector the SetupOnStart
property will be enabled by default. If enabled this means that when this scene is run it will automatically create a custom Windows registry that will enable us to launch the application from a web URL.
The deeplinking setup process for MacOS is exactly the same as for iOS. In any case you can find the steps below.
Go to Edit > Project Settings > Player > Other Settings > Configuration.
Expand Supported URL schemes to set the following properties:
Size property to 1
.
Element 0 property to the URL scheme to use with your application. For example, use playerzero0000
to open your application when the device processes a link that starts with playerzero0000://
.
Remember to replace the number 0000
in playerzero0000
with your unique GAMEID
to ensure you are using your own unique scheme.
Now that we have enabled deeplinking we can make use of the PlayerZeroSdk.OnHotLoadedAvatarIdChanged
event.
Lets create a new C# script and call it DeepLinkingSample.
First we will create a load avatar function that uses our PlayerZeroSDK functions to request, download and instantiate the character model.
Now we can create a new function that uses the PlayerZeroSDK.HotLoadedAvatarId()
to get the avatarId
.
Now you can use the LoadHotLoadedAvatar()
function whenever you want to load the avatar.
Alternatively you can subscribe to the PlayerZeroSdk.OnHotLoadedAvatarIdChanged
event which is automatically triggered whenever a new avatar id has been detected.
To do this lets we can use the Awake function subscribe to the OnHotLoadedAvatarIdChanged
event and assign a new function that loads the avatar.
Don't forget to unsubscribe to the event
Below you can find the full sample script.
The steps for this process can also be found on the .
To enable deeplinking for desktop applications on Windows we a custom entry needs to be added to the Window registry. Without this it is not possible to trigger the application to launch from a web URL. For more information on Windows registries including how to add and remove them please refer to the .
The following guide is intended for games that are not going to be published on Steam, if your game or application is going to be published on Steam we recommend using the for app deeplinking as if offers a more robust solution, particularly in regards to deferred deeplinking as it utilizes Steams built in deeplink features.
The steps for this process can also be found on the .