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:

  1. 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 
  1. 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", ...

Get Unity 2017 Mobile Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.