I am using the Parse Unity SDK along with the Facebook Unity SDK in my game so users can log in with their Facebook account.
It's working well on mobiles (Android and iOS), and in the editor.
In Facebook Canvas (WebPlayer), on my machine (Mac Mini), with my main session (Administrator), with every browsers (Chrome, Safari, Firefox), I get an error upon calling this code :
Debug.Log("ABOUT TO LOGIN");
ParseFacebookUtils.LogInAsync( FB.UserId,FB.AccessToken,
FB.AccessTokenExpiresAt).ContinueWith(x =>
{
Debug.Log("IN TASK");
if(x.IsFaulted || x.IsCanceled)
{
Debug.LogError("[FacebookManager] Error LogInAsync");
Debug.Log(x.Exception);
}
else
{
// Connection successful
// ...
}
}
// CODE CONTINUES...
The output is as follows :
ABOUT TO LOGIN
TrySetSetString can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
IN TASK
[FacebookManager] Error LogInAsync
System.AggregateException: Exception of type 'System.AggregateException' was thrown.
---------
System.ArgumentException: TrySetSetString can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
at (wrapper managed-to-native) UnityEngine.PlayerPrefs:TrySetSetString (string,string)
at UnityEngine.PlayerPrefs.SetString(System.String key, System.String value)[0x00000] in /Applications/buildAgent/work/___SOME_ID____/artifacts/WebPlayerGenerated/PlayerPrefsBinding.cs:62
at Parse.PlatformHooks+SettingWrapper.Save()[0x00000] in <filename unknown>:0
at Parse.PlatformHooks+SettingWrapper.set_Item (System.String key, System.Object value) [0x00000] in <filename_unknown>:0
at Parse.ParseUser.SaveCurrentUser(Parse.ParseUser user) [0x00000] in <filename unkwnown>:0
at Parse.ParseUser.<SignUpAsync>b__0 (Sustem.Threading.Tasks.Task _) [0x00000] in <filename unknown>:0
at Parse.Internal.InternalExtensions+<>c__DisplayClassa.<OnSuccess>b__9 (System.Threading.Tasks.Task t) [0x00000] in <filename unknown>:0
at Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[System.Object].<OnSuccess>b__6 (System.Threading.Tasks.Task t) [0x00000] in <filename unknown>:0
at System.Threading.Tasks.Task+<>c__DisplayClass3`1+<>c__DisplayClass5[System.Threading.Tasks.Task`1[System.Object]].<ContinueWith>b__2 () [0x00000] in <filename unknown>:0
This error doesn't appear on other sessions on my machine, and it doesn't appear on my teammates' machines either.
Here is what I tried so far (not necessarily in that order) :
Additionaly, there are numerous times where the game doesn't even load (blank canvas instead of Game Logo + loading bar). Blank web player also happens sometimes when going to unity3d.com/webplayer/setup.
I am fairly certain that the problem comes either from a permission conflict, or a cache I don't know of.
Any idea what I can try now ?
I encountered the same issue. In my case problem was in the Web Player Development Release Channel. Try to switch from Development to Release Channel.