Unity API Reference
Classes
SkillzCrossPlatform (Asynchronous Methods)
The main point of interaction with Skillz.
LaunchSkillz
Launches the Skillz UI. This method is overloaded.
public static void LaunchSkillz(SkillzMatchDelegate _matchDelegate);
Parameters
_matchDelegate
A reference to a SkillzMatchDelegate
instance that Skillz will use.
public static void LaunchSkillz(SkillzSyncDelegate _syncMatchDelegate);
Parameters
_syncMatchDelegate
A reference to a SkillzSyncDelegate
instance that Skillz will use.
IsMatchInProgress
Checks if a match is currently in progress.
public static bool IsMatchInProgress();
Returns
A bool indicating if a match if is in progress.
GetMatchRules
Returns the match rules that you set up in the Skillz Developer Console for each match type.
public static Hashtable GetMatchRules();
Returns
A Hashtable
containing a key-value pair for each rule of the current match type.
GetMatchInfo
public static Match GetMatchInfo();
Returns
A Match
object containing information about the current match in progress.
Match
Represents a Skillz match. Below are some of the properties that list specific details of the match.
Name
string
The name of the tournament type that was selected for the match.
Description
string
Description for the tournament type that was selected for the match.
ID
ulong
The unique ID for this match.
Template ID
int
Unique ID of the tournament type that was selected for the match.
SkillzDifficulty
uint
If Automatic Difficulty is enabled, returns the difficulty level for the match, 1 to 10 inclusive. Otherwise, returns null
.
IsCash
bool
Indicates whether the match is being played for real cash or Z.
EntryCash
float
The amount of cash required to play in the match if IsCash
returns true
. Otherwise, returns null
.
EntryPoints
int
The amount of Z required to play in the match if IsCash
returns false
. Otherwise, returns null
.
IsSynchronous
Deprecated. This property is deprecated and will be removed in a future version of the SDK.
GameParams
Dictionary<string, string>
Key-value pairs of Gameplay Parameters of the tournament type that were set up in the Skillz Developer Console.
Players
List<Player>
Returns a list of the players competing in the match.
Player
Represents a player competing in a match.
DisplayName
string
The player's display name.
ID
ulong
The player's unique ID in the entire Skillz platform.
TournamentPlayerID
ulong
The player's unique ID for the match.
AvatarURL
string
Returns a url for the player's avatar image.
FlagURL
string
Returns a url for the player's country flag image.
IsCurrentPlayer
bool
Indicates if the player is the person playing the match on the device.
AbortMatch
Forfeits the current match and returns to the Skillz UI.
public static void AbortMatch();
UpdatePlayersCurrentScore
Call this method every time the player's score changes during a Skillz match. This method is overloaded.
SkillzCrossPlatform.UpdatePlayersCurrentScore(string score);
Parameters
score
The player's current score as a string.
SkillzCrossPlatform.UpdatePlayersCurrentScore(int score);
Parameters
score
The player's current score as an integer.
SkillzCrossPlatform.UpdatePlayersCurrentScore(float score);
Parameters
score
The player's current score as a float.
ReportFinalScore
Call this method when a player finishes a match. This will report the result of the game to the Skillz server, and return the player to the Skillz UI. This method is overloaded.
public static void ReportFinalScore(String score)
Parameters
score
The player's final score as a string.
public static void ReportFinalScore(int score)
Parameters
score
The player's final score as an integer.
public static void ReportFinalScore(float score)
Parameters
score
The player's final score as a float.
SDKVersionShort
Gets the version of the Skillz SDK your game is being run on.
public static string SDKVersionShort();
Returns
The Skillz SDK's version as a string.
GetPlayer
Gets information about the player.
public static SkillzSDK.Player GetPlayer();
Returns
A Player
instance.
SkillzCrossPlatform (Synchronous Methods)
This is the main point of interaction with Skillz for synchronous matches.
SendData
Sends data to the player's opponent.
public static void SendData(byte[] data);
Parameters
data
An array of raw bytes to send to the opponent.
IsMatchCompleted
Checks if the current synchronous match is completed.
public static bool IsMatchCompleted();
Returns
A bool indicating if the synchronous match is completed.
GetConnectedPlayerCount
Gets the number of players connected to the current synchronous match.
public static int GetConnectedPlayerCount();
Returns
The number of players connected to the current synchronous match.
GetCurrentPlayerId
Gets the current player's ID.
public static long GetCurrentPlayerId();
Returns
A long representing the current player's ID.
GetCurrentOpponentPlayerId
Get the current opponent's player ID.
public static long GetCurrentOpponentPlayerId();
Returns
The current opponent's ID as a long.
GetServerTime
Gets the time on the Skillz server.
public static double GetServerTime();
Returns
The time on the Skillz server in seconds.
GetTimeLeftForReconnection
Gets the time remaining for the player to reconnect once disconnected. Reconnect time is strictly decreasing and does not reset after successful connections to prevent griefing.
Note: If the value returned is negative, the player should be considered aborted from the match.
public static long GetTimeLeftForReconnection(long playerId);
Parameters
playerId
The player's ID
Returns
The time left for the player to reconnect, if disconnected, in milliseconds.
SkillzCrossPlatform.Random
Value
Use the Skillz random implementation to ensure each competitor recieves the exact same random number.
SkillCrossPlatform.Random.Value()
InsideUnitSphere
Find a point inside the unit sphere using Value()
.
public static Vector3 InsideUnitSphere();
InsideUnitCircle
Find a point inside the unit circle using Value()
.
public static Vector2 InsideUnitCircle();
OnUnitSphere
Hybrid rejection / trig method to generate points on a sphere using Value()
.
public static Vector3 OnUnitSphere();
RotationUniform
Quaternion random using Value()
.
public static Quaternion RotationUniform();
Rotation
Quaternion random using Value()
.
public static Quaternion Rotation();
Range
Ranged random using Value()
. This method is overloaded.
public static float Range(float min, float max);
public static int Range(int min, int max);
Parameters
min
The minimum value.
max
The maximum value.
Returns
The random value in between min
and max
, inclusive.
Interfaces
SkillzMatchDelegate
Implement this interface to be notified when an asynchronous match is about to begin, and for other events of interest.
OnMatchWillBegin
Called when an asynchronous match is about to begin.
void OnMatchWillBegin(Match matchInfo);
Parameters
matchInfo
A Match
object containing info about the match.
OnSkillzWillExit
Called when the Skillz UI is exiting via the sidebar menu.
void OnSkillzWillExit();
SkillzSyncDelegate
Implement this interface if your game supports synchronous matches.
OnCurrentPlayerHasLeftMatch
Called when the current player has left the match.
void OnCurrentPlayerHasLeftMatch();
OnCurrentPlayerHasLostConnection
Called when the current player is disconnected from the Skillz server.
void OnCurrentPlayerHasLostConnection();
OnCurrentPlayerHasReconnected
Called when the current player has reconnected to the Skillz server.
void OnCurrentPlayerHasReconnected();
OnDidReceiveData
Called when the opponent has sent data to the current player.
void OnDidReceiveData(byte[] value);
OnMatchCompleted
Called when the synchronous match has completed.
void OnMatchCompleted();
OnOpponentHasLeftMatch
Called when an opponent has left the match.
void OnOpponentHasLeftMatch(ulong playerId);
Parameters
playerId
The ID of the opponent that has left the match/
OnOpponentHasLostConnection
Called when an opponent has disconnected from the Skillz server.
void OnOpponentHasLostConnection(ulong playerId);
playerId
The ID of the opponent that was disconnected.
OnOpponentHasReconnected
Called when an opponent has reconnected to the Skillz server.
void OnOpponentHasReconnected(ulong playerId);
Parameters
playerId
The ID of the opponent that has reconnected.