In this article, you'll learn how to create the Skillz Delegate and how to perform the necessary Skillz function calls. If you haven't installed the Unity SDK to your Unity project, please refer to this article on how to do so.
Note: If you have previously integrated a Unity SDK, please find the relevant migration instructions below:
- Updating from v17.x:
- If you are on Skillz SDK 17.0.x or lower, you may need to update your codebase. Skillz SDKs 18.0.x and above support cross platform integration which means you will only need one codebase in order to release to both iOS and Android. Check out steps 3-8 of this article to learn about the new function calls you should make.
- Updating from v18.x:
- In v18.x, you added your integration to SkillzDelegate.cs directly. In this new version (19.x and higher), SkillzDelegate.cs is now an internal Skillz only file. DO NOT MODIFY THIS UPDATED FILE. Instead, you should save your integration from SkillzDelegate.cs, and you will re-add this later as part of creating a class which implements the SkillzSyncDelegate interface.
Step 1: Generate the Skillz Delegate
Open the initial game scene that Unity will load when starting a new match, and select Skillz -> Generate Delegate
This will create a "SkillzDelegate" game object for you. This “SkillzDelegate” game object will contain your game’s ID, orientation, and the Skillz Delegate Script.
Step 2: Modify your Skillz Delegate
Edit your "SkillzDelegate" game object. Input your game ID and choose whether it's in a sandbox or production environment. Make sure to choose sandbox if you are still in the testing phase of your integration.
Next, click on the SkillzDelegate script and open it in your favorite code editor. Implement your
OnSkillzWillExit methods by specifying what scene should load in that particular situation.
OnMatchWillBegin is required to implement, while
OnSkillzWillExit is optional if your game is not meant to exit out of the Skillz UI.
Step 3: Launch Skillz
You can launch Skillz by creating a button specifically for that purpose, or you can have Skillz launch automatically, as soon as Unity opens.
public void Play ()
Step 4: Add Game Parameters to your game
If you want to add game parameters to your game, you can add them in the Developer Portal. These game parameters can change the experience of each tournament since you can pass these parameters onto your code and use them to diversify the gaming experience. You can retrieve these game parameters by calling:
This will return a Hashtable; for more information on Game Parameters, see this article.
Step 5: Updating the Player's Current Score
You should update the player's current score each time the score increments or decrements in the UI. This helps detect potential cheating and fraudulent activities by players in the game.
if (SkillzCrossPlatform.IsMatchInProgress ())
Note: You can use isMatchInProgress to check whether the player is in a Skillz game or not.
Step 6: Report the Player's Final Score
When the game ends, you will need to report the final score to the Skillz servers. This will launch the Skillz UI and present the results to the player.
if (SkillzCrossPlatform.IsMatchInProgress ())
Note: You can use
isMatchInProgress to check whether the player is in a Skillz game or not. It may be useful at this point to unload some of your game objects in order to reduce memory pressure.
Step 7: Aborting Players
Certain games allow players to abort a match. This means that no score will be submitted, and they will automatically forfeit to their opponent. If your game allows mid-match aborts, then you should call the following:
This will notify Skillz that the player has aborted, and redisplay the Skillz UI.
Step 8: Implement Skillz Random for fairness
If your gameplay makes use of random numbers, you should use the Skillz Random Number Generator. For example, if your game creates a random map for each match, using this will present the exact same random map to both players in the match, to ensure the matches are fair. Inside the SkillzCrossPlatform.cs file, there is a Random class that you can use to implement fairness in your game.
WARNING: Skillz Fairness Migration
If you are updating your current integration from any v17.x and lower to the new cross-platform wrapper (v18.x and above) you will need to take special consideration on how you use the Skillz random number generator methods. The RNG method must remain consistent across both versions to ensure a fair experience for all users playing on different versions of your game.
This means that if you previously were using the now deprecated iOS only function "Api.GetRandomNumber()", rather than the Random class, you will need to switch to using SkillzCrossplatform.Random.Value(), and will need to disable old binaries when releasing this update in order to ensure fairness.
Should you require any guidance or assistance in this transition, email firstname.lastname@example.org.
You have now finished the required integration steps. Feel free to build to an Android device or to export to an Xcode Project for iOS. If you’d like to learn more, you can read about advanced Skillz Unity API features here.