Class FBInstant
The main entry point to the Facebook Instant Games SDK.
Inherited Members
Namespace: Meta.InstantGames
Assembly: Unity.Meta.InstantGames.Sdk.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 |
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 |
---|---|
Web |
A Web |
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
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 |
---|---|
Web |
A Web |
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 |
---|---|
Web |
A Web |
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 |
---|---|
Web |
A Web |
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 |
---|---|
Web |
A Web |
HideBannerAdAsync()
Attempt to hide a banner ad. Exceptions: CLIENT_UNSUPPORTED_OPERATION
Declaration
public static WebTask HideBannerAdAsync()
Returns
InitializeAsync()
Initializes the SDK library. This should be called before any other SDK functions.
Declaration
public static WebTask InitializeAsync()
Returns
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 |
---|---|
Web |
A Web |
PerformHapticFeedbackAsync()
Requests and performs haptic feedback on supported devices. Exceptions: CLIENT_UNSUPPORTED_OPERATION, INVALID_OPERATION
Declaration
public static WebTask PerformHapticFeedbackAsync()
Returns
Quit()
Quits the game.
Declaration
public static void Quit()
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 Web
Declaration
public static WebTask StartGameAsync()
Returns
UpdateAsync(CustomUpdatePayload)
Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. The returned Web
Declaration
public static WebTask UpdateAsync(CustomUpdatePayload payload)
Parameters
Type | Name | Description |
---|---|---|
Custom |
payload | A payload that describes the update |
Returns
UpdateAsync(LeaderboardUpdatePayload)
Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. The returned Web
Declaration
public static WebTask UpdateAsync(LeaderboardUpdatePayload payload)
Parameters
Type | Name | Description |
---|---|---|
Leaderboard |
payload | A payload that describes the update |