docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class FBInstant

    The main entry point to the Facebook Instant Games SDK.

    Inheritance
    object
    FBInstant
    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 static class FBInstant

    Properties

    Context

    Contains functions and properties related to the current game context.

    Declaration
    public static Context Context { get; }
    Property Value
    Type Description
    Context

    Payments

    Contains functions and properties related to payments and purchases of game products.

    Declaration
    public static Payments Payments { get; }
    Property Value
    Type Description
    Payments

    Player

    Contains functions and properties related to the current player.

    Declaration
    public static Player Player { get; }
    Property Value
    Type Description
    Player

    Tournament

    Contains functions and properties related to tournaments.

    Declaration
    public static Tournaments Tournament { get; }
    Property Value
    Type Description
    Tournaments

    Methods

    CanCreateShortcutAsync()

    Returns whether or not the user is eligible to have shortcut creation requested. Will return false if createShortcutAsync was already called this session or the user is ineligible for shortcut creation. Exceptions: PENDING_REQUEST, CLIENT_REQUIRES_UPDATE, INVALID_OPERATION

    Declaration
    public static WebTask<bool> CanCreateShortcutAsync()
    Returns
    Type Description
    WebTask<bool>

    A WebTask<T> that resolves with true if the game can request the player create a shortcut to the game, and false otherwise

    CreateShortcutAsync()

    Prompts the user to create a shortcut to the game if they are eligible to. Can only be called once per session. Exceptions: USER_INPUT, PENDING_REQUEST, CLIENT_REQUIRES_UPDATE, INVALID_OPERATION

    Declaration
    public static WebTask CreateShortcutAsync()
    Returns
    Type Description
    WebTask

    A WebTask.

    GetInterstitialAdAsync(string)

    Attempt to create an instance of an interstitial ad. This instance can then be preloaded and presented. Exceptions: ADS_TOO_MANY_INSTANCES, CLIENT_UNSUPPORTED_OPERATION

    Declaration
    public static WebTask<AdInstance> GetInterstitialAdAsync(string placementID)
    Parameters
    Type Name Description
    string placementID

    The placement ID that's been set up in your Audience Network settings.

    Returns
    Type Description
    WebTask<AdInstance>

    A WebTask<T> that resolves with an AdInstance or rejects with an APIError if it couldn't be created.

    GetRewardedInterstitialAsync(string)

    Attempt to create an instance of rewarded interstitial. This instance can then be preloaded and presented. Exceptions: ADS_TOO_MANY_INSTANCES, CLIENT_UNSUPPORTED_OPERATION

    Declaration
    public static WebTask<AdInstance> GetRewardedInterstitialAsync(string placementID)
    Parameters
    Type Name Description
    string placementID

    The placement ID that's been set up in your Audience Network settings.

    Returns
    Type Description
    WebTask<AdInstance>

    A WebTask<T> that resolves with an AdInstance or rejects with an APIError if it couldn't be created.

    GetRewardedVideoAsync(string)

    Attempt to create an instance of rewarded video. This instance can then be preloaded and presented. Exceptions: ADS_TOO_MANY_INSTANCES, CLIENT_UNSUPPORTED_OPERATION

    Declaration
    public static WebTask<AdInstance> GetRewardedVideoAsync(string placementID)
    Parameters
    Type Name Description
    string placementID

    The placement ID that's been set up in your Audience Network settings.

    Returns
    Type Description
    WebTask<AdInstance>

    A WebTask<T> that resolves with an AdInstance or rejects with an APIError if it couldn't be created.

    GetSupportedAPIs()

    Provides a list of API functions that are supported by the client. Note that these are the names from the JavaScript SDK. The corresponding C# property and method names begin with a capital letter.

    Declaration
    public static string[] GetSupportedAPIs()
    Returns
    Type Description
    string[]

    A list of API functions that the client explicitly supports.

    GetTournamentAsync()

    Fetch the instant tournament out of the current context the user is playing. This will reject if there is no instant tournament link to the current context. The instant tournament returned can be either active or expired (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: PENDING_REQUEST, NETWORK_FAILURE, INVALID_OPERATION, TOURNAMENT_NOT_FOUND

    Declaration
    public static WebTask<Tournament> GetTournamentAsync()
    Returns
    Type Description
    WebTask<Tournament>

    A WebTask<T> containing a Tournament.

    HideBannerAdAsync()

    Attempt to hide a banner ad. Exceptions: CLIENT_UNSUPPORTED_OPERATION

    Declaration
    public static WebTask HideBannerAdAsync()
    Returns
    Type Description
    WebTask

    A WebTask that resolves after the ad is hidden.

    InitializeAsync()

    Initializes the SDK library. This should be called before any other SDK functions.

    Declaration
    public static WebTask InitializeAsync()
    Returns
    Type Description
    WebTask

    A WebTask that resolves when the SDK is ready to use.

    LoadBannerAdAsync(string, string)

    Attempt to load or re-load a banner ad. Exceptions: RATE_LIMITED, CLIENT_UNSUPPORTED_OPERATION

    Declaration
    public static WebTask LoadBannerAdAsync(string placementID, string bannerPosition = "bottom")
    Parameters
    Type Name Description
    string placementID

    The placement ID that's been set up in your Audience Network settings.

    string bannerPosition

    An optional parameter that sets the position of the banner to be "top" or "bottom." The default is a banner at the bottom of the screen.

    Returns
    Type Description
    WebTask

    A WebTask<T> that resolves after loading a banner ad, or rejects with an APIError if it couldn't be created.

    OnPause(Action)

    Set a callback to be fired when a pause event is triggered.

    Declaration
    public static void OnPause(Action func)
    Parameters
    Type Name Description
    Action func

    A function to call when a pause event occurs.

    PerformHapticFeedbackAsync()

    Requests and performs haptic feedback on supported devices. Exceptions: CLIENT_UNSUPPORTED_OPERATION, INVALID_OPERATION

    Declaration
    public static WebTask PerformHapticFeedbackAsync()
    Returns
    Type Description
    WebTask

    A WebTask when haptic feedback was requested successfully.

    Quit()

    Quits the game.

    Declaration
    public static void Quit()

    SetSessionData(string)

    Sets the data associated with the individual gameplay session for the current context. This function should be called whenever the game updates the current session data. This session data may be used to populate a variety of payloads, such as game play webhooks.

    Declaration
    public static void SetSessionData(string sessionData)
    Parameters
    Type Name Description
    string sessionData

    An arbitrary data object, which must be less than or equal to 1000 characters when stringified.

    StartGameAsync()

    This indicates that the game has finished initial loading and is ready to start. Context information will be up-to-date when the returned WebTask resolves. Exceptions: INVALID_PARAM, CLIENT_UNSUPPORTED_OPERATION

    Declaration
    public static WebTask StartGameAsync()
    Returns
    Type Description
    WebTask

    A WebTask that resolves when the game should start.

    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)