Example Ios Unity

by skillz
+

Example project for Skillz iOS integration with a Unity application

( Updated 4 hours ago )

Unity Example Project

This repo contains an example of a very simple Unity "game" with Skillz integration. The purpose of this example is to show the bare minimum of code needed to use Skillz correctly. This project supports being built into either landscape mode or portrait mode.

This project is setup to work with the latest version of the Skillz Unity-iOS SDK, which can be found at https://skillz.com/developer/downloads. Once the SDK is downloaded, the Skillz embedded framework will need to be added to the project.

The Installation for this project was divided into 3 major steps: Installing the Skillz framework,Implementing Core Skillz, and Implementing Skillz Fairness.

Skillz example instructions

Step 1: This commit completed the Installing the Skillz framework step of the Skillz Integration.

  • This step adds the framework to the project and configures the project to link with the Skillz framework.

Step 2: This commit completed the Implementing Core Skillz step of the Skillz Integration.

  • This step integrates the Skillz platform with the project and will add multiplayer tournaments using the Skillz API.

Step 3: This commit completed the Implementing Skillz Fairness step of the Skillz Integration.

  • This step ensures that the players' games are fair by implementing a consistent random number generation.

For additional SDK installation details refer to the Skillz documentation.

Details

The game starts at a "main menu" screen and moves to a "gameplay" screen when a tournament starts (though the "gameplay" is really just a couple of buttons allowing the player to choose what his score will be).

In the MainMenu.unity scene are two different objects:

  • "Main Menu" -- the behavior for the game's main menu
  • "SkillzDelegate" -- the object generated by Skillz when you follow the integration instructions on the Developer Portal.

In order to set the orientation for the game, you must do the following two things:

  • Set the orientation value in the "SkillzDelegate" object dropdown.
  • Set the orientation enum value in the "SkillzDelegate" object's "MySkillzDelegateBase" script.
  • Go into Unity's Player Settings, under the iOS tab inside the Resolution and Presentation block, and set the Default Orientation to either Portrait or Landscape Left.

Build

Building this project uses the standard Unity build process. When buildling to Xcode, Unity/Skillz will show a pop-up asking which orientation your game uses.

File -> Build Settings -> Set Platform to iOS (if needed) -> Build This will create the Xcode project for iOS.

Once the Xcode project is generated, it should build without any extra work!

Run

Running the project through Xcode as you would any other project.

Note: An Xcode project file is missing since it was too big to upload to Github. In order to run this app on Xcode, you will need to re-build on Xcode using Unity.

Visit our website to learn more about Skillz!