I have build an empty project and tried it out. It worked just fine. Then I tried to use the SDK on my unity game. My game was working without any issue before adding the SDK. After adding the SDK whenever I try to call the login function I get the following error.
Code:
UnityPlayer.AppCallbacks.Instance.InvokeOnUIThread(delegate ()
{
Login(permissions);
}, false);
public static async void Login(string permissions)
{
FBSession sess = FBSession.ActiveSession;
sess.FBAppId = "xxxxx";
sess.WinAppId = "xxxx";
// Add permissions required by the app
List<String> permissionList = new List<String>();
permissionList.Add("public_profile");
FBPermissions permissionsList = new FBPermissions(permissionList);
// Login to Facebook
Facebook.FBResult result = await sess.LoginAsync(permissionsList);
if (result.Succeeded)
{
// Login successful
System.Diagnostics.Debug.WriteLine("---------------------Login Succeeded");
}
else
{
// Login failed
System.Diagnostics.Debug.WriteLine("---------------------Login Failed");
}
}
Interesting thing is, after I press “continue” on the debug window of Visual Studio, the game continues and even login works properly. But I do get the error and forced breakpoint is set every time I run the game.