Sets the state of the Facebook SDK, and initializes all platform-specific data structures and behaviors. This function can only be called once during the lifetime of the object; later calls lead to undefined behavior.
Init() relies on properties that are set in the Unity Editor using the Facebook | Edit settings menu option, as detailed below.
There are two signatures for this function. The first takes most of its parameters from the Facebook settings in the editor:
public static void Init(
InitDelegate onInitComplete = null,
HideUnityDelegate onHideUnity = null,
string authResponse = null
)| Name | Type | Description | Default |
|---|---|---|---|
|
| A function that will be called once all data structures in the SDK are initialized; any code that should synchronize with the player's Facebook session should be in |
|
|
| A function that will be called when Facebook tries to display HTML content within the boundaries of the Canvas. When called with its sole argument set to |
|
|
| effective in Web Player only, rarely used A Facebook |
|
| Name | Type | Description | Default |
|---|---|---|---|
|
| The Facebook application ID of the initializing app. Required | |
|
| Sets a cookie which your server-side code can use to validate a user's Facebook session |
|
|
| If |
|
|
| If |
|
|
| If |
|
The Web platform can make use of certain platform-specific attributes which other platforms will safely ignore; see the documentation for the Javascript SDK's FB.init() for details of their function.
Note: Init often requires an asynchronous read operation, and any code that depends on its being completed should be synchronized in the HideUnityDelegate passed into Init().
FB.Init();
Check out the SDK Examples for a more complete sample usage of where and when to use FB.Init in your Unity application.