Get Facebook User name with Facebook sdk Unity android

Hi I m developing an Android Game, i can login to facebook and want to return the facebook id and user name and display them via guitext. Thanks for your help

using Facebook.minijson;

FB.API("me?fields=name", Facebook.HttpMethod.GET, UserCallBack);
public string get_data;
public string fbname;

void UserCallBack(FBResult result) {
  if (result.Error != null)
  {                                                                      
     get_data = result.Text;
  }
  else
  {
     get_data = result.Text;
  }
  var dict = Json.Deserialize(get_data) as IDictionary;
  fbname =dict ["name"].ToString();
}

NOTE : display fbname using GUIText.

add this code to your script where u need username to be fetched, it will definitely help you … comment your result so i can understand your problem clearly after this… thank you.

Typed Callbacks

FBResult has been replaced.
Method callbacks are now typed and have distinct result classes. For example: FB.API will return an IGraphResult and FB.Canvas.Pay will return an IPayResult. Refer to the call signature of each method to learn its result class.

Parsing callback results are simplified with the typed callbacks.

FB.API("/me?fields=first_name", HttpMethod.GET, delegate (IGraphResult result) {
  // Add error handling here
  if (result.ResultDictionary != null) {
    foreach (string key in result.ResultDictionary.Keys) {
      Debug.Log(key + " : " + result.ResultDictionary[key].ToString());
      // first_name : Chris
      // id : 12345678901234567
    }
  }
});