Unity Integration Guide
This guide will walk you through the setup process for the Mirror World Smart SDK on Unity.
1. Create a Developer Account
Create a developer account on the Developer dashboard. Create project and create an API Key. If you already have an API Key, you may skip this step and proceed to the next one.
2. Import the Mirror World SDK
There are 2 ways to install the Mirror World Unity SDK:
-
One way is to download the latest release assets from the official GitHub repository. Import it to your project
Assets > Import Package > Custom Package
and select the package you just downloaded. -
You may also search for the package in the Unity Assets Store with the keyword "
com.mirror.sdk
" and import it.
3. Configuration
Manual configuration with prefab
Explanation of the fields above image:
Api Key
: Input your API key from the developer dashboard.Debug Mode
: If you check this, you will be able to see all the console output and error notices on the console.Environment
: Choose the environment you want to use.Debug Email and Password
: In the pre-release beta, you can only login to the SDK using this function.
Dynamic Configuration
If you don't want to add a game object to your scene,you can init Mirror World SDK with the following code:
4. Usage
After configuring the SDK, if you want to call some API of SDK in your app, you should lead users to login first.
Call up login page
And if you want to do something after the logging is successful,you can pass an action to it as follows code:
Packaging Your Application
After development, you need to do some configuration if you want to package your app for distribution.
Packaging for Android
Switch to Android platform Find File -> Build and settings -> Choose Android platform (If you are not) -> Click switch platform button.`
Edit AndroidManifest.xml
Find: File → Build and settings → Player Settings → Publishing Settings → Build → Custom Main Manifest
Check it, and you may see the path of this file. Let's edit it to add permissions for internet
Register this activity
Register Activity
Finally your AndroidManifest.xml
file should look like this:
Configure launcherTemplate.gradle
Use the same function to open your launcherTemplate.gradle
file.
Add this to dependencies:
So the final dependencies may like this:
Configure gradleTemplate.properties
Add these lines to the end of the file:
For more information, you can refer to the official Android documentation.
Packaging For iOS
Build your XCode project
Find File → Build and settings → iOS → Switch Platform → Build
Add Mirror World Framework
Open the build XCode project.
Select your project root → TARGETS / Unity-iPhone → Build pharses → Copy Files
Change the destination to "Frameworks" and click "+" button to add MirrorWorldSDK.framework
to your project.
Edit UnityAppController.mm
First, add this import to head of the file:
So, finally your openUrl function should look like this:
Going Further
Great! At this point you're pretty much ready to start doing building with the Unity SDK for Mirror World. There are a few things you can do to proceed from here:
- Explore the Full Unity API Reference to learn more.
- Looking for inspiration? Take a look at our Guides or see what builders are building in the Showcase.
- Join the Mirror World Developer community! We're a vibrant community of builders!
Getting Support
If you're stuck or just looking for support, you may also schedule a support call with our team.
Unity Integration Guide
This guide will walk you through the setup process for the Mirror World Smart SDK on Unity.
1. Create a Developer Account
Create a developer account on the Developer dashboard. Create project and create an API Key. If you already have an API Key, you may skip this step and proceed to the next one.
2. Import the Mirror World SDK
There are 2 ways to install the Mirror World Unity SDK:
-
One way is to download the latest release assets from the official GitHub repository. Import it to your project
Assets > Import Package > Custom Package
and select the package you just downloaded. -
You may also search for the package in the Unity Assets Store with the keyword "
com.mirror.sdk
" and import it.
3. Configuration
Manual configuration with prefab
Explanation of the fields above image:
Api Key
: Input your API key from the developer dashboard.Debug Mode
: If you check this, you will be able to see all the console output and error notices on the console.Environment
: Choose the environment you want to use.Debug Email and Password
: In the pre-release beta, you can only login to the SDK using this function.
Dynamic Configuration
If you don't want to add a game object to your scene,you can init Mirror World SDK with the following code:
4. Usage
After configuring the SDK, if you want to call some API of SDK in your app, you should lead users to login first.
Call up login page
And if you want to do something after the logging is successful,you can pass an action to it as follows code:
Packaging Your Application
After development, you need to do some configuration if you want to package your app for distribution.
Packaging for Android
Switch to Android platform Find File -> Build and settings -> Choose Android platform (If you are not) -> Click switch platform button.`
Edit AndroidManifest.xml
Find: File → Build and settings → Player Settings → Publishing Settings → Build → Custom Main Manifest
Check it, and you may see the path of this file. Let's edit it to add permissions for internet
Finally your AndroidManifest.xml
file should look like this:
Configure launcherTemplate.gradle
Use the same function to open your launcherTemplate.gradle
file.
Add this to dependencies:
So the final dependencies may like this:
Configure gradleTemplate.properties
Add these lines to the end of the file:
For more information, you can refer to the official Android documentation.
Packaging For iOS
Build your XCode project
Find File → Build and settings → iOS → Switch Platform → Build
Add Mirror World Framework
Open the build XCode project.
Select your project root → TARGETS / Unity-iPhone → Build pharses → Copy Files
Change the destination to "Frameworks" and click "+" button to add MirrorWorldSDK.framework
to your project.
Edit UnityAppController.mm
First, add this import to head of the file:
So, finally your openUrl function should look like this:
Going Further
Great! At this point you're pretty much ready to start doing building with the Unity SDK for Mirror World. There are a few things you can do to proceed from here:
- Explore the Full Unity API Reference to learn more.
- Looking for inspiration? Take a look at our Guides or see what builders are building in the Showcase.
- Join the Mirror World Developer community! We're a vibrant community of builders!
Getting Support
If you're stuck or just looking for support, you may also schedule a support call with our team.