C# Class Facebook.Unity.FB

Static class for exposing the facebook integration.
Inheritance: UnityEngine.ScriptableObject
Mostra file Open project: facebook/facebook-sdk-for-unity

Private Properties

Property Type Description
LogVersion void

Public Methods

Method Description
API ( string query, HttpMethod method, FacebookDelegate callback = null, string>.IDictionary formData = null ) : void

Makes a call to the Facebook Graph API.

API ( string query, HttpMethod method, FacebookDelegate callback, WWWForm formData ) : void

Makes a call to the Facebook Graph API.

ActivateApp ( ) : void

Sends an app activation event to Facebook when your app is activated. On iOS and Android this event is logged automatically. You may still need to call this event if you are running on web. On iOS the activate event is fired when the app becomes active On Android the activate event is fired during FB.Init

AppRequest ( string message, IEnumerable to = null, IEnumerable filters = null, IEnumerable excludeIds = null, int maxRecipients = null, string data = "", string title = "", FacebookDelegate callback = null ) : void

Apps the request.

AppRequest ( string message, Facebook.Unity.OGActionType actionType, string objectId, IEnumerable filters = null, IEnumerable excludeIds = null, int maxRecipients = null, string data = "", string title = "", FacebookDelegate callback = null ) : void

Apps the request.

AppRequest ( string message, Facebook.Unity.OGActionType actionType, string objectId, IEnumerable to, string data = "", string title = "", FacebookDelegate callback = null ) : void

Apps the request.

FeedShare ( string toId = "", Uri link = null, string linkName = "", string linkCaption = "", string linkDescription = "", Uri picture = null, string mediaSource = "", FacebookDelegate callback = null ) : void

Legacy feed share. Only use this dialog if you need the legacy parameters otherwiese use FB.ShareLink(System.String, System.String, System.String, System.String, Facebook.FacebookDelegate.

GameGroupCreate ( string name, string description, string privacy = "CLOSED", FacebookDelegate callback = null ) : void

Opens a dialog to create a new game group.

GameGroupJoin ( string id, FacebookDelegate callback = null ) : void

Opens a dialog to join a game group.

GetAppLink ( FacebookDelegate callback ) : void

Gets the deep link if available.

Init ( InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null, string authResponse = null ) : void

This is the preferred way to call FB.Init(). It will take the facebook app id specified in your "Facebook" => "Edit Settings" menu when it is called.

Init ( string appId, string clientToken = null, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, string javascriptSDKLocale = FB.DefaultJSSDKLocale, HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null ) : void

If you need a more programmatic way to set the facebook app id and other setting call this function. Useful for a build pipeline that requires no human input.

LogAppEvent ( string logEvent, float valueToSum = null, object>.Dictionary parameters = null ) : void

Logs an app event.

LogInWithPublishPermissions ( IEnumerable permissions = null, FacebookDelegate callback = null ) : void

Logs the user in with the requested publish permissions.

LogInWithReadPermissions ( IEnumerable permissions = null, FacebookDelegate callback = null ) : void

Logs the user in with the requested read permissions.

LogOut ( ) : void

Logs out the current user.

LogPurchase ( float logPurchase, string currency = null, object>.Dictionary parameters = null ) : void

Logs the purchase.

ShareLink ( Uri contentURL = null, string contentTitle = "", string contentDescription = "", Uri photoURL = null, FacebookDelegate callback = null ) : void

Opens a share dialog for sharing a link.

Private Methods

Method Description
LogVersion ( ) : void

Method Details

API() public static method

Makes a call to the Facebook Graph API.
public static API ( string query, HttpMethod method, FacebookDelegate callback = null, string>.IDictionary formData = null ) : void
query string /// The Graph API endpoint to call. /// You may prefix this with a version string to call a particular version of the API. ///
method HttpMethod The HTTP method to use in the call.
callback FacebookDelegate The callback to use upon completion.
formData string>.IDictionary The key/value pairs to be passed to the endpoint as arguments.
return void

API() public static method

Makes a call to the Facebook Graph API.
public static API ( string query, HttpMethod method, FacebookDelegate callback, WWWForm formData ) : void
query string /// The Graph API endpoint to call. /// You may prefix this with a version string to call a particular version of the API. ///
method HttpMethod The HTTP method to use in the call.
callback FacebookDelegate The callback to use upon completion.
formData UnityEngine.WWWForm Form data for the request.
return void

ActivateApp() public static method

Sends an app activation event to Facebook when your app is activated. On iOS and Android this event is logged automatically. You may still need to call this event if you are running on web. On iOS the activate event is fired when the app becomes active On Android the activate event is fired during FB.Init
public static ActivateApp ( ) : void
return void

AppRequest() public static method

Apps the request.
public static AppRequest ( string message, IEnumerable to = null, IEnumerable filters = null, IEnumerable excludeIds = null, int maxRecipients = null, string data = "", string title = "", FacebookDelegate callback = null ) : void
message string The request string the recipient will see, maximum length 60 characters.
to IEnumerable A list of Facebook IDs to which to send the request.
filters IEnumerable /// The configuration of the platform multi-friend selector. /// It should be a List of filter strings. ///
excludeIds IEnumerable /// A list of Facebook IDs to exclude from the platform multi-friend selector dialog. /// This list is currently not supported for mobile devices. ///
maxRecipients int /// Platform-dependent The maximum number of recipients the sender should be able to /// choose in the platform multi-friend selector dialog. /// Only guaranteed to work in Unity Web Player app. ///
data string /// Additional data stored with the request on Facebook, and handed /// back to the app when it reads the request back out. /// Maximum length 255 characters. ///
title string /// The title for the platform multi-friend selector dialog. Max length 50 characters. ///
callback FacebookDelegate A callback for when the request completes.
return void

AppRequest() public static method

Apps the request.
public static AppRequest ( string message, Facebook.Unity.OGActionType actionType, string objectId, IEnumerable filters = null, IEnumerable excludeIds = null, int maxRecipients = null, string data = "", string title = "", FacebookDelegate callback = null ) : void
message string The request string the recipient will see, maximum length 60 characters.
actionType Facebook.Unity.OGActionType Request action type for structured request.
objectId string /// Open Graph object ID for structured request. /// Note the type of object should belong to this app. ///
filters IEnumerable /// The configuration of the platform multi-friend selector. /// It should be a List of filter strings. ///
excludeIds IEnumerable /// A list of Facebook IDs to exclude from the platform multi-friend selector dialog. /// This list is currently not supported for mobile devices. ///
maxRecipients int /// Platform-dependent The maximum number of recipients the sender should be able to /// choose in the platform multi-friend selector dialog. /// Only guaranteed to work in Unity Web Player app. ///
data string /// Additional data stored with the request on Facebook, and handed /// back to the app when it reads the request back out. /// Maximum length 255 characters. ///
title string /// The title for the platform multi-friend selector dialog. Max length 50 characters. ///
callback FacebookDelegate A callback for when the request completes.
return void

AppRequest() public static method

Apps the request.
public static AppRequest ( string message, Facebook.Unity.OGActionType actionType, string objectId, IEnumerable to, string data = "", string title = "", FacebookDelegate callback = null ) : void
message string The request string the recipient will see, maximum length 60 characters.
actionType Facebook.Unity.OGActionType Request action type for structured request.
objectId string /// Open Graph object ID for structured request. /// Note the type of object should belong to this app. ///
to IEnumerable A list of Facebook IDs to which to send the request.
data string /// Additional data stored with the request on Facebook, /// and handed back to the app when it reads the request back out. /// Maximum length 255 characters.
title string The title for the platform multi-friend selector dialog. Max length 50 characters..
callback FacebookDelegate A callback for when the request completes.
return void

FeedShare() public static method

Legacy feed share. Only use this dialog if you need the legacy parameters otherwiese use FB.ShareLink(System.String, System.String, System.String, System.String, Facebook.FacebookDelegate.
public static FeedShare ( string toId = "", Uri link = null, string linkName = "", string linkCaption = "", string linkDescription = "", Uri picture = null, string mediaSource = "", FacebookDelegate callback = null ) : void
toId string /// The ID of the profile that this story will be published to. /// If this is unspecified, it defaults to the value of from. /// The ID must be a friend who also uses your app. ///
link System.Uri The link attached to this post.
linkName string The name of the link attachment.
linkCaption string /// The caption of the link (appears beneath the link name). /// If not specified, this field is automatically populated /// with the URL of the link. ///
linkDescription string /// The description of the link (appears beneath the link caption). /// If not specified, this field is automatically populated by information /// scraped from the link, typically the title of the page. ///
picture System.Uri /// The URL of a picture attached to this post. /// The picture must be at least 200px by 200px. /// See our documentation on sharing best practices for more information on sizes. ///
mediaSource string /// The URL of a media file (either SWF or MP3) attached to this post. /// If SWF, you must also specify picture to provide a thumbnail for the video. ///
callback FacebookDelegate The callback to use upon completion.
return void

GameGroupCreate() public static method

Opens a dialog to create a new game group.
public static GameGroupCreate ( string name, string description, string privacy = "CLOSED", FacebookDelegate callback = null ) : void
name string The name of the group you wish to create.
description string A short description of the group's purpose.
privacy string /// The privacy of the group. /// OPEN groups' content is visible to anyone /// CLOSED groups can be found by anyone but their content is only visible to members /// SECRET groups can only be found by their members. ///
callback FacebookDelegate The callback to use upon completion.
return void

GameGroupJoin() public static method

Opens a dialog to join a game group.
public static GameGroupJoin ( string id, FacebookDelegate callback = null ) : void
id string The group ID of the group to which you'd like to add the user.
callback FacebookDelegate The callback to use upon completion.
return void

GetAppLink() public static method

Gets the deep link if available.
public static GetAppLink ( FacebookDelegate callback ) : void
callback FacebookDelegate The callback to use upon completion.
return void

Init() public static method

This is the preferred way to call FB.Init(). It will take the facebook app id specified in your "Facebook" => "Edit Settings" menu when it is called.
public static Init ( InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null, string authResponse = null ) : void
onInitComplete InitDelegate /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find /// out when you can safely call the other methods. ///
onHideUnity HideUnityDelegate A delegate to invoke when unity is hidden.
authResponse string Auth response.
return void

Init() public static method

If you need a more programmatic way to set the facebook app id and other setting call this function. Useful for a build pipeline that requires no human input.
public static Init ( string appId, string clientToken = null, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, string javascriptSDKLocale = FB.DefaultJSSDKLocale, HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null ) : void
appId string App identifier.
clientToken string App client token.
cookie bool If set to true cookie.
logging bool If set to true logging.
status bool If set to true status.
xfbml bool If set to true xfbml.
frictionlessRequests bool If set to true frictionless requests.
authResponse string Auth response.
javascriptSDKLocale string /// The locale of the js sdk used see /// https://developers.facebook.com/docs/internationalization#plugins. ///
onHideUnity HideUnityDelegate /// A delegate to invoke when unity is hidden. ///
onInitComplete InitDelegate /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find /// out when you can safely call the other methods. ///
return void

LogAppEvent() public static method

Logs an app event.
public static LogAppEvent ( string logEvent, float valueToSum = null, object>.Dictionary parameters = null ) : void
logEvent string The name of the event to log.
valueToSum float A number representing some value to be summed when reported.
parameters object>.Dictionary Any parameters needed to describe the event.
return void

LogInWithPublishPermissions() public static method

Logs the user in with the requested publish permissions.
/// Thrown when called on a TV device. ///
public static LogInWithPublishPermissions ( IEnumerable permissions = null, FacebookDelegate callback = null ) : void
permissions IEnumerable A list of requested permissions.
callback FacebookDelegate Callback to be called when request completes.
return void

LogInWithReadPermissions() public static method

Logs the user in with the requested read permissions.
/// Thrown when called on a TV device. ///
public static LogInWithReadPermissions ( IEnumerable permissions = null, FacebookDelegate callback = null ) : void
permissions IEnumerable A list of requested permissions.
callback FacebookDelegate Callback to be called when request completes.
return void

LogOut() public static method

Logs out the current user.
public static LogOut ( ) : void
return void

LogPurchase() public static method

Logs the purchase.
public static LogPurchase ( float logPurchase, string currency = null, object>.Dictionary parameters = null ) : void
logPurchase float The amount of currency the user spent.
currency string The 3-letter ISO currency code.
parameters object>.Dictionary /// Any parameters needed to describe the event. /// Elements included in this dictionary can't be null. ///
return void

ShareLink() public static method

Opens a share dialog for sharing a link.
public static ShareLink ( Uri contentURL = null, string contentTitle = "", string contentDescription = "", Uri photoURL = null, FacebookDelegate callback = null ) : void
contentURL Uri The URL or the link to share.
contentTitle string The title to display for this link..
contentDescription string /// The description of the link. If not specified, this field is automatically populated by /// information scraped from the link, typically the title of the page. ///
photoURL Uri The URL of a picture to attach to this content.
callback FacebookDelegate A callback for when the request completes.
return void