0

Is there any way to get error details from the FB.API() call in the Facebook Unity SDK? This code

FB.API(
  query: "/me/achievements",
  callback: response => {
    if (!string.IsNullOrEmpty(response.Error)) {
      Logger.LogError("FB ReportProgress Error: " + response.Error);
    } else {
      Logger.Log("FB ReportProgress response: " + response.Text);
    }
  },
  method: Facebook.HttpMethod.POST,
  formData: new Dictionary<string, string>() {{"achievement", url}}
);

logs "400 Bad Request" and nothing else.

1 Answers1

0

First you have to enable MonoDevelop's debugger:

  • In MonoDevelop go to the Preferences, then Unity > Debugger
  • Untick "Build project in MonoDevelop" and click OK
  • Run > Attach To Process...
  • Select Unity Editor, click OK

Then, set a breakpoint inside the callback. Select this line in your code and select Run > New Breakpoint...

Logger.LogError("FB ReportProgress Error: " + response.Error);

Then hit Play in Unity and trigger the error (breakpoint). It'll switch to MonoDevelop. Down in the Locals debug window (which should be in a tab somewhere, otherwise View > Debug Windows > Locals) expand the FBResult object. The actual error message (which I assume you're needing) can be found under FBResult > data > responseHeaderString.

More info on MonoDevelop debugging: http://unitygems.com/debugging-game-monodevelop/

  • Sorry, I see that you don't necessarily want just the error message. It's simply a case of moving the breakpoint up to the first line of your callback. – Peter Dekkers Sep 10 '14 at 07:19