Skip to main content
Version: 26.2.9

How to Build Your Unity Game

If you're here, you've:

  1. Installed the Skillz SDK.
  2. Launched the Skillz UI.
  3. Set up either a Play and Compare or Realtime Sync core loop
  4. Used the Unity Companion to test your game's workflow with Skillz.

And are ready to test your Skillz integrated game on an actual mobile device. Follow the instructions below on how to build your game for iOS or Android.

Build Your Game For iOS

Set the Target iOS Version

Go to your iOS Player Settings -> Configuration, and set the target minimum iOS version to 10.0 or higher.

Set target iOS Version

Build to an Xcode Project

Go to File -> Build Settings, select iOS then Build. You should be prompted to locate where you saved the Skillz.framework file.

Set the App's Orientation

Open the Xcode project. In UnityAppController.mm, find the function called application:supportedInterfaceOrientationsForWindow. Currently, this method's body looks similar to:

- (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);

Disable Bitcode (If Needed)

If you are building on a device, you may run into an error about your game not supporting bitcode. Here’s an example error:

/Skillz.framework/Skillz does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64


In Unity 2019.2 or earlier, you can disable this by going to your target's Build Settings then setting Enable Bitcode to 'No':

Disable Bitcode Unity 2019.2


For Unity 2019.3, you will need to disable this for both the "Unity-iPhone" and "UnityFramework" targets:

Disable Bitcode Unity 2019.3

You should now be able to build on a device via Xcode.

We’re always here to help. Contact us if you run into any issues.

Set Up Android Builds

The following steps are required before you build your game for the first time.

Regenerate Android Files

Make sure that Skillz emitted a few files in Assets/Plugins/Android/.

In Unity 2019.2 or earlier, these will be:

  • mainTemplate.gradle
  • multidex-keep.txt
  • proguard-user.txt

For Unity 2019.3 or later, these will be:

  • baseProjectTemplate.gradle
  • mainTemplate.gradle
  • launcherTemplate.gradle
  • multidex-keep.txt
  • proguard-user.txt

If any of these files is missing, please:

  1. Select the Skillz > Regenerate Android Files menu item command.
  2. A prompt may appear asking for permission to overwrite the files listed above. Select "Yes".
  3. Save your project, close it, and reopen it. This is because the Unity editor does not always refresh correctly.
  4. Verify that the files listed above are now present in Assets/Plugins/Android/ before proceeding.

Important

The mainTemplate.gradle that Skillz emits ensures that an exported Android Studio project will compile and run successfully (with Skillz). Other libraries, such as Firebase, may overwrite it. Make sure that it is the one that Skillz emits. If you're unsure, run the Skillz > Regenerate Android Files menu item command.

The dependencies section should contain lines similar to:

dependencies {
implementation ("com.skillz.sdk:skillz-sdk-android:<sdk_version_string>")
{
transitive = false
}
}

Configure Google Play Services Resolver

Skillz for Unity is bundled with the Google Play Services Resolver plugin. This plugin will resolve transitive dependencies between multiple libraries (that support it) for Android, such as Skillz and Firebase. However, preliminary configuration is needed:

  1. Select the Assets > Play Services Resolver > Android Resolver > Settings menu item.
  2. Click the "Reset to Defaults" button as a precaution.
  3. Uncheck the "Enable Auto-Resolution" option.
  4. Make sure the "Patch mainTemplate.gradle" option is checked.
    • By selecting this option, the Play Services Resolver will modify Assets/Plugins/Android/mainTemplate.gradle with the list of resolved of resolved dependencies.
    • The final build.gradle file in an exported Android Studio project will list these dependencies.
    • This approach is recommended by Google. Otherwise, the plugin will download the resolved dependencies as JARs/AARs.
  5. Check the "Use Jetifier" option. Skillz requires the new AndroidX Support Libraries, instead of the original Android Support Libraries. Checking the Jetifier option ensures that all libraries that depend on the original Android Support Libraries are migrated to the equivalent AndroidX ones.
  6. Click the "OK" button to save your changes.

Help, the "Use Jetifier" Option Is Missing

If the "Use Jetifier" option is missing, it is possible that you installed another library that had an older version of the Google Play Services Resolver. You'll have to reinstall the copy that is bundled with the Skillz SDK:

  1. Delete the Assets/PlayServicesResolver folder.
  2. Reimport the Skillz SDK.
  3. From the import dialog, ensure the "PlayServicesResolver" folder, and all its subfolders and files, are checked.
  4. Click the Import button.

Resolve Android Dependencies

With the Play Services Resolver configured, it's time to resolve your Unity project's Android dependencies. Select Assets > Play Services Resolver > Android Resolver > Resolve. A message box will display after resolution has completed.

Afterwards, verify that mainTemplate.gradle was modified to ensure that all resolved dependencies are listed.

The dependencies section should look similar to this snippet before modification:

dependencies {
implementation ("com.skillz.sdk:skillz-sdk-android:<sdk_version_string>")
{
transitive = false
}
**DEPS**
}

And it should look similar to this snippet after modification:

dependencies {
implementation ("com.skillz.sdk:skillz-sdk-android:<sdk_version_string>")
{
transitive = false
}
// Android Resolver Dependencies Start
implementation 'android.arch.lifecycle:extensions:1.1.1' // Assets/Skillz/Editor/SkillzDependencies.xml:109
implementation 'com.airbnb.android:lottie-react-native-skillz:2.6.2' // Assets/Skillz/Editor/SkillzDependencies.xml:29

// Etc., etc.

If the file did not appear to be changed, you may have to save your project, reopen it, and select the Assets > Play Services Resolver > Android Resolver > Force Resolve menu item.

Build Your Game For Android

NOTE

The Skillz SDK does NOT support building an APK directly from Unity. Please export your project to Android Studio, as described in the section below, when you need to build an APK.

Change Android Build Settings to use ARM64

Navigate to your Android Player Settings via Edit > Project Settings > Player > Android Icon. Change "Scripting Backend" to IL2CPP. Under "Target Architectures" check the box next to ARM64.

Export to Android Studio

If you choose to export to Android Studio, make sure to click on Export Project.

Export to Android Studio

Then, in Android Studio, go to File > New > Import Project and select the exported directory. Your Android studio project will contain a build.gradle file that was generated from Assets/Plugins/Android/mainTemplate.gradle of your Unity project.

For projects exported from Unity 2019.2 or earlier, this file will be at the project level. For projects exported from Unity 2019.3 or later, this file will be in the project's unityLibrary module.

Perform any changes you wish to make in the (Android Studio) project and you should now be able to build and run your game on a device.

Contact us if you run into any issues.