Updating Unity from Skillz SDK 18x to 19x+

This document is for developers who have previously integrated the v18.x Unity SDK and are looking to update their integration to using the latest v19.x and later releases of our Unity SDK. This latest version of the Unity SDK now provides support for real-time, synchronous gameplay along with improvements and miscellaneous bug fixes.

Step 1:

Delete the Assets/Skillz folder in Unity

Make sure to save any custom code you wrote in any of these Skillz files for safe keeping. In your Unity project, delete the Skillz folder located within Assets in your Unity project.

Screen_Shot_2018-02-09_at_1.34.39_PM.png


Step 2:

Import the new Unity package

WIth your Unity project open, double click on the Unity package,  skillz_unity_crossplatform.unitypackage, found inside the downloaded Unity SDK.

Screen_Shot_2018-02-06_at_11.52.57_AM_copy.png

Step 3:

Ensure SkillzDelegate game object has your game ID and a SkillzDelegate script

If a SkillzDelegate script is no longer attached to the game object, you can simply attach the SkillzDelegate script that came with the downloaded Unity SDK. You can also delete the SkillzDelegate gameobject and regenerate it again by clicking on Skillz > Generate Delegate in the Unity header toolbar.

Screen_Shot_2018-02-09_at_1.39.33_PM.png

Screen_Shot_2018-02-09_at_1.39.48_PM.png 

Note: In the 19.0.x Skillz Unity SDK, you no longer have to edit the SkillzDelegate script that’s attached to your SkillzDelegate game object.

Step 4:

Create a controller class to implement either SkillzSyncDelegate or SkillzMatchDelegate interface

If you are looking to support real-time, synchronous gameplay create a Controller class which implements the SkillzSyncDelegate interface.

public class GameSyncController : MonoBehaviour, SkillzSyncDelegate
{

}

 

If your game supports asynchronous gameplay, create a Controller class which implements the SkillzMatchDelegate interface.

public class GameController : MonoBehaviour, SkillzMatchDelegate
{

}

Step 5:

Update your OnMatchWillBegin and OnSkillzWillExitcallbacks

Previously in the v18.x integration, these callbacks were implemented in the SkillzDelegate script - these will now be implemented in the controller class you’ve created in the previous step.

OnMatchWillBegin

Make sure to load your game scene in this function. You can use the IsSynchronous boolean in the SkillzSDK.Match object to determine whether the match is synchronous or asynchronous. (This match object can also be fetched directly from the Skillz API by calling GetMatchInfo).

public void OnMatchWillBegin (SkillzSDK.Match matchInfo)
{
    if (matchInfo.IsSynchronous)
    {
        isSyncMatch = true;
    }
    else
    {
        isSyncMatch = false;
    }
    SceneManager.LoadScene(“Game-c#”);
}

OnSkillzWillExit(optional)

If you’d like the option for a user to exit the Skillz interface and load your initial main menu, you can load that scene here. This function is called by the Skillz SDK when a user exits out of the skillz experience.

public void OnSkillzWillExit ()
{
    SceneManager.LoadScene("Menu-c#");
}

More information can be found in this article

 

Step 6:

Follow the rest of the implementation, steps 3 - 8 listed in this article.

 

WARNING: Skillz Fairness Migration

You will need to take special consideration on how you use the Skillz random number generator methods.  The RNG method must remain consistent across all versions to ensure a fair experience for all users playing on different versions of your game.

 

This means that if you previously were using "Api.GetRandomNumber()", rather than the Api.Random class and related functions on iOS, 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 integrations@skillz.com.  

 

Note: The adjustments required for iOS build process still remains

  1. You will need to target minimum iOS version to 9.0 or higher
  2. You will need to modify supportedInterfaceOrientationsForWindow in UnityAppController.mm

See steps 1 and 5 of this article for details.