Hello…
Has anyone integrated Unity Facebook in UWP ? There is Facebook SDK for Unity but it doesn’t support UWP. I have tried using winsdkfb to show login dialog, but I got an error at LoginAsync. (error attached) I use InvokeOnUIThread from unity so the LoginAsync runs on UI thread.
(Build setting and player setting are attached)
Note: I make empty C# UWP app from visual studio (not from unity) and using same winsdkfb. And the app can successfully show login dialog.
my unity C# code:
private void OnLoginButtonClick()
{
#if UNITY_WSA && ENABLE_WINMD_SUPPORT
SessionLoginBehavior loginBehavior = SessionLoginBehavior.WebView;
FBSession sess = FBSession.ActiveSession;
sess.FBAppId = "xxxxxxxx";
sess.WinAppId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
List<String> permissionList = new List<String>();
permissionList.Add("user_friends");
permissionList.Add("user_photos");
FBPermissions permissions = new FBPermissions( permissionList );
UnityEngine.WSA.Application.InvokeOnUIThread(async () =>
{
FBResult result = await sess.LoginAsync(permissions, loginBehavior);
if (result.Succeeded)
{
FBUser user = sess.User;
UnityEngine.Debug.Log(sess.User.Id);
UnityEngine.Debug.Log(sess.User.Name);
}
else
{
UnityEngine.Debug.Log("login failed");
}
}, waitUntilDone: true);
#endif
}
… or maybe there is another sdk for UWP to login facebook ???