Skip to main content
Version: 28.0.18

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.

Enable Android Auto-Resolution​

A dialog may pop up asking to enable Android Auto-Resolution. If prompted, click Enable. Enabling this feature is also done in a later step, so it is not critical at this point.

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​

Configure External Dependency Manager​

Skillz for Unity is bundled with the External Dependency Manager plugin. This plugin will resolve transitive dependencies between multiple libraries for iOS. Preliminary configuration is needed:

  1. Select the Assets > External Dependency Manager > iOS Resolver > Settings menu item.
  2. Click the Reset to Defaults button as a precaution.
  3. Click the OK button to save your changes.

Install CocoaPods​

The External Dependency Manager can install CocoaPods for you, if it is not already installed:

  1. Select Assets > External Dependency Manager > iOS Resolver > Install Cocoapods
  2. Click OK in the pop-up confirming installation was successful.

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.

note

Select environment Sandbox for development and testing. Come back here and switch to Production when readying the build for publishing to the app stores.

caution

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. In the lower left click Player Settings...Optimal Resolution1
  3. Select Player from the sidebar and click on the iOS tab.
  4. Under Settings for iOS, 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

Metal Write-Only Backbuffer​

  1. In Unity select File > Build Settings...
  2. In the lower left click Player Settings...
  3. Select Player from the sidebar and click on the iOS tab.
  4. Under Settings for iOS, expand Other Settings:
    • Deselect Metal Write-Only Backbuffer

metal backbuffer 5. Close the window. It will automatically save your new settings

Disallow Downloads over HTTP​

  1. In Unity select File > Build Settings...
  2. In the lower left click Player Settings...
  3. Select Player from the sidebar and click on the iOS tab.
  4. Under Settings for iOS, expand Other Settings:
    • Deselect Allow downloads over HTTP (nonsecure)

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. When complete, the project can be opened by double-clicking the *.xcworkspace file. Do not open the project using the *.xcodeproj file, as it will not properly initialize the CocoaPod dependencies.

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 8.9.0, as it has been tested with the Skillz SDK.