Installation
1. Required Unity Version
Unity version should be equal or greater than 2022.3.62f1. If you encounter any version compatibility issues, please feel free to contact us.
2. Add Scoped Registry
Modify your Unity project's manifest.json
to include the Cross SDK scoped registry:
{
"scopedRegistries": [
{
"name": "Cross",
"url": "https://package.cross-nexus.com/repository/cross-sdk-unity/",
"scopes": [
"com.nexus.cross"
]
}
],
"dependencies": {
"com.nexus.cross.sdk.unity": "1.3.0",
"com.nexus.cross.core": "1.3.0",
"com.nexus.cross.core.common": "1.3.0",
"com.nexus.cross.core.crypto": "1.3.0",
"com.nexus.cross.core.network": "1.3.0",
"com.nexus.cross.core.storage": "1.3.0",
"com.nexus.cross.sign": "1.3.0",
"com.nexus.cross.sign.nethereum": "1.3.0",
"com.nexus.cross.sign.nethereum.unity": "1.3.0",
"com.nexus.cross.sign.unity": "1.3.0",
"com.nexus.cross.unity.dependencies": "1.3.0"
// add more wanted dependencies
}
}
3. SDK Initialization
Create a new script CrossInitializer.cs
in the Assets/Scripts
folder:
using UnityEngine;
using Cross.SDK;
public class CrossInitializer : MonoBehaviour
{
private async void Start()
{
var config = new CrossSdkConfig
{
projectId = "your_project_id",
metadata = new Metadata(
name: "Your App Name",
description: "App Description",
url: "https://yourapp.com",
iconUrl: "https://yourapp.com/icon.png"
)
};
await CrossSdk.InitializeAsync(config);
}
}
4. Deep Link Configuration
To enable deep linking with the CROSSx app, you need to configure your app to handle the crossx://
scheme. This allows your app to open the CROSSx wallet when users need to sign transactions or interact with the blockchain.
iOS Configuration
For iOS, you need to add the following configuration to your Info.plist
file to allow the app to query for the CROSSx scheme:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>crossx</string>
</array>
This configuration tells iOS that your app may need to check if the CROSSx app is installed and potentially open it.
Android Configuration
For Android, you need to add the following configuration to your AndroidManifest.xml
file:
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="crossx" />
</intent>
</queries>
This configuration allows your Android app to query for and interact with apps that handle the crossx://
scheme, which is necessary for deep linking functionality.
Additional Considerations
- URL Scheme Handling: Your app should also be configured to handle incoming deep links if you want to return to your app after the user completes an action in CROSSx.
- Fallback Handling: Consider implementing fallback behavior for cases where the CROSSx app is not installed on the user's device.
- Testing: Always test deep linking functionality on both iOS and Android devices to ensure proper integration.
Updated 10 days ago