Skip to main content
Version: 27.1.3

Unity

This article will walk you through installing the Skillz SDK in your Unity project.

1. Download Skillz SDK​

The latest version of the Skillz SDK for Unity can be found at the Downloads section of the Skillz Developer Console.

Decompress the file after it has finished downloading. Everything will be decompressed into a folder named sdk_unity_<SDK_VERSION>. Relative to that folder will be /unity/skillz_unity-<SDK_VERSION>.unitypackage where SDK_VERSION is the version of the Skillz SDK that was downloaded.

2. Import Unity Package​

With your project open in Unity, click the Assets > Import Package > Custom Package... menu item. Select the skillz_unity-<SDK_VERSION>.unitypackage file from the previous step.

A dialog will pop up where you can choose the assets from the package to import. Click the All button to select all. Next, click the Import button. Importing Unity Package

Overwrite Android Build Files​

A dialog will pop up asking permission to overwrite Android build files. Select Yes.

Disable Registry Addition​

Skillz bundles a plugin by Google called the External Dependency Manager (EDM), which is used to resolve Android dependencies. On import of the Skillz SDK, EDM will display a dialog, similar to the screenshot below, to ask if you would like to add additional Unity Package Manager registries. Click the Disable Registry Addition button to dismiss the dialog.

Disable Registry Addition

The Skillz SDK is now installed in your Unity project. You should see an Assets/Skillz/ folder in your project tab.

3. Resolve Dependencies​

There is nothing to do for iOS. Continue to next step.

4. Configure Game for Skillz​

Select the Skillz > Settings menu item to bring up the Skillz Settings window:

Set your Game ID, the environment (Sandbox or Production), and the orientation for your game.

Please ensure to select the correct orientation if you plan to distribute your game on Android. This setting is important for ensuring your game renders in the correct orientation for gameplay. For instance, if the scene for your main menu is designed for Portrait mode, but your game scene is designed for Landscape, the orientation setting should be set to Landscape.

Additionally, you can choose if users are allowed to exit the Skillz UI via its sidebar menu.

5. Build and Run​

Unity Player Configuration​

Optimal Resolution Scaling​

  1. In Unity select File > Build Settings...
  2. If Platform selection is not iOS, select iOS and click Switch Platform
  3. In the lower left click Player Settings...Optimal Resolution1
  4. Select Player from the left navigation and expand Resolution and Presentation:
    • Select Resolution Scaling Mode: Fixed DPI
    • Set Target DPI to 328

Optimal Resolution1 5. Close the window. It will automatically save your new settings

Initiate Build​

Click Build to initiate the build process. Unity will prompt for a destination to save the XCode project. During the build process, Unity will also prompt for location of the Skillz.framework folder which is included in the SDK download archive.

Set the App Orientation​

After the successful creation of the Xcode project, open the project. In {Project}/Classes/, locate and open UnityAppController.mm. Find the method called application:supportedInterfaceOrientationsForWindow. Currently, this method's body looks similar to:

UnityAppController.mm
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
if ([window rootViewController] == nil)
return UIInterfaceOrientationMaskAll;

return [[window rootViewController] supportedInterfaceOrientations] | _forceInterfaceOrientationMask;
}

Since Skillz doesn’t support switching orientations between portrait and landscape, you’ll need to modify this function to support only either portrait or landscape:

return (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationPortraitUpsideDown);

It is suggested to build and run the project on the target platforms to resolve any conflicts or issues prior to further Skillz implementation. Once the project has been tested, please move on to implementing the Skillz UI.

Firebase​

If you plan on adding Firebase to your Unity project, we recommend you use Unity Firebase 6.15.1, as it has been tested with the Skillz SDK.

Checklist​

  1. Verify Tech Requirements
  2. Get Game ID from Skillz Developer Console
  3. Install the SDK
  4. Build and Test
  5. Implement the Skillz Delegate
  6. Initialize Skillz
  7. Launch Skillz
  8. Exit Skillz
  9. Build and Test
  10. Launch Gameplay
  11. Submit the Score
  12. End Replay
  13. Return to Skillz
  14. Implement Score Reporting Fallback
  15. Handle Incomplete Matches
  16. Build and Test