Skip to main content
Version: 26.2.9

Set up Your Game for Play and Compare Gameplay

This article will walk you through setting up your game for Play and Compare gameplay on Skillz. Make sure you have implemented the Skillz Delegate before proceeding.

Handling Match Starts

When Skillz has launched, it will take control of your game by displaying its UI on top. Here, the user will eventually enter a match. When that happens, Skillz will notify the game. At this point, control will be given back to your game to launch the gameplay portion of its UI. The examples below illustrate how to do this.

In the example for launching Skillz, we implemented the SkillzMatchDelegate interface. We'll now handle a match start. You will need to launch the scene representing your gameplay in the OnMatchWillBegin method:

SkillzGameController.cs
using UnityEngine;

public class SkillzGameController : SkillzMatchDelegate
{
public void OnMatchWillBegin(SkillzSDK.Match matchInfo)
{
// A match is about to being. Launch the appropriate scene for your game
SceneManager.LoadScene("GameplayScene");
}
}

Report Final Score

Once a game is complete you should report the final score. Doing so will simultaneously take you back to the Skillz UI.

You should report the final score from a script that controls your game scene logic.

MatchController.cs
using Skillz;
using UnityEngine;

public class MatchController : MonoBehaviour
{
private bool matchFinished;

private void Update()
{
if (matchFinished)
{
SkillzCrossPlatform.ReportFinalScore(score);
}
}
}

Aborting a Match

Aborting a match is an alternative to reporting the final score. When a player aborts a match, they have forfeited it to the opponent.

SkillzCrossPlatform.AbortMatch();

Play Your Loop

Now it's time to test your game loop with Skillz. Please compile and run your game on a mobile device. If your game is made with Unity, you can use the Unity Companion to simulate your game loop with Skillz from the Unity editor. Once you have verified its workflow with Skillz works from the editor, follow the instructions on how to export and build your project for iOS or Android.

When you test your game loop, be sure to go to the Developer Console to have it report the user's score back and receive your second checkmark.

Please Note

If you don't plan on creating a real-time game you can skip the next section (Realtime Sync).