Displaying Facebook name and profile pic
A good thing to do is to personalize our game to fit our player. So, with that, once the player logs in, we will welcome them and display their image on the screen by following these steps:
- Go to the
MainMenuBehaviour
script once again. From there, we'll need to add a new using statement as to display an image and change text we need to use Unity's UI system:
using UnityEngine.UI; // Text / Image
- Afterward, we will update the
ShowMainMenu
function and add some new functions to use:
public void ShowMainMenu() { if (facebookLogin != null && mainMenu != null) { facebookLogin.SetActive(false); mainMenu.SetActive(true); if (FB.IsLoggedIn) { // Get information from Facebook profile FB.API("/me?fields=name", HttpMethod.GET, SetName); FB.API("/me/picture?width=256&height=256", HttpMethod.GET, SetProfilePic...