docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Tournaments

    Contains functions and properties related to instant tournaments.

    Inheritance
    object
    JsObject
    Tournaments
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Meta.InstantGames.v8
    Assembly: Unity.Meta.InstantGames.Sdk.v8.dll
    Syntax
    public class Tournaments : JsObject

    Constructors

    Tournaments()

    Construct an instance of Tournaments

    Declaration
    public Tournaments()

    Methods

    CreateAsync(CreateTournamentPayload)

    Opens the tournament creation dialog if the player is not currently in a tournament session.Exceptions: INVALID_PARAM, INVALID_OPERATION, DUPLICATE_POST, NETWORK_FAILURE

    Declaration
    public WebTask<Tournament> CreateAsync(CreateTournamentPayload payload)
    Parameters
    Type Name Description
    CreateTournamentPayload payload

    Tournament creation options

    Returns
    Type Description
    WebTask<Tournament>

    A WebTask<T> containing a Tournament.

    GetTournamentsAsync()

    Returns a list of eligible tournaments that can be surfaced in-game, including tournaments 1) the player has created; 2) the player is participating in; 3) the player's friends (who granted permission) are participating in. The instant tournaments returned are active. An instant tournament is expired if its end time is in the past. For each instant tournament, there is only one unique context ID linked to it, and that ID doesn't change. Exceptions: NETWORK_FAILURE, INVALID_OPERATION

    Declaration
    public WebTask<Tournament[]> GetTournamentsAsync()
    Returns
    Type Description
    WebTask<Tournament[]>

    A WebTask<T> containing a list of Tournament.

    JoinAsync(string)

    Request a change into a specific tournament context. If the player is not a participant of the tournament, or there are not any connected players participating in the tournament, this will reject. Otherwise, the promise will resolve when the game has changed into the specified context.Exceptions: INVALID_OPERATION, INVALID_PARAM, SAME_CONTEXT, NETWORK_FAILURE, USER_INPUT, TOURNAMENT_NOT_FOUND

    Declaration
    public WebTask JoinAsync(string tournamentID)
    Parameters
    Type Name Description
    string tournamentID

    The Tournament ID of the desired context to change into.

    Returns
    Type Description
    WebTask

    A WebTask that resolves when the game has changed into the specified tournament context, or rejects otherwise.

    PostScoreAsync(double)

    Posts a player's score to Facebook. This API should only be called within a tournament context at the end of an activity (example: when the player doesn't have "lives" to continue the game). This API will be rate-limited when called too frequently. Scores posted using this API should be consistent and comparable across game sessions. For example, if Player A achieves 200 points in a session, and Player B achieves 320 points in a session, those two scores should be generated from activities where the scores are fair to be compared and ranked against each other. Returns a promise that resolves when the score post is completed. Exceptions: INVALID_PARAM, TOURNAMENT_NOT_FOUND, NETWORK_FAILURE

    Declaration
    public WebTask PostScoreAsync(double score)
    Parameters
    Type Name Description
    double score

    An integer value representing the player's score at the end of an activity.

    Returns
    Type Description
    WebTask

    A WebTask that resolves when the score post is completed.

    ShareAsync(ShareTournamentPayload)

    Opens the reshare tournament dialog if the player is currently in a tournament sessionExceptions: INVALID_OPERATION, TOURNAMENT_NOT_FOUND, NETWORK_FAILURE

    Declaration
    public WebTask ShareAsync(ShareTournamentPayload payload)
    Parameters
    Type Name Description
    ShareTournamentPayload payload

    Specifies share content

    Returns
    Type Description
    WebTask

    A WebTask that resolves if the tournament is shared, or rejects otherwise.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)