facebook_init

This code initialises Facebook.

Syntax:

facebook_init(appKey)


Returns: N/A


Description

Before using any of the Facebook functions you must call this function to initialize the Facebook API and tell GameMaker: Studio that you are going to be using the Facebook specific functions. This should be done only once in the game and can be done at any time, but it is recommended that you call this function right at the start before anything else. Note too, that even if you use facebook_logout at some point in your game you will not need to use this function again to log in.


Example:

facebook_init();
var permissions = ds_list_create();
ds_list_add(permissions,"public_profile", "user_friends");
facebook_login(permissions);
ds_list_destroy(permissions);

The above code initialises Facebook, then creates a ds_list to hold the specific permissions that you wish to request, and finally logs in using these permissions.


Back: Facebook
Next: facebook_login
© Copyright YoYo Games Ltd. 2018 All Rights Reserved