Hello, I'm having trouble getting WebGL builds to work. It throws NullRef after LoginWithCustomID request, this never happens in Editor.
This is the error I'm getting:
NullReferenceException: Object reference not set to an instance of an object. at PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) [0x00000] in <00000000000000000000000000000000>:0 at PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) [0x00000] in <00000000000000000000000000000000>:0 at PlayFab.Json.PlayFabSimpleJson.DeserializeObject (System.String json, System.Type type, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) [0x00000] in <00000000000000000000000000000000>:0 at PlayFab.Json.PlayFabSimpleJson.DeserializeObject[T] (System.String json, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) [0x00000] in <00000000000000000000000000000000>:0 at PlayFab.Json.SimpleJsonInstance.DeserializeObject[T] (System.String json) [0x00000] in <00000000000000000000000000000000>:0 at PlayFab.Internal.PlayFabUnityHttp.OnResponse (System.String response, PlayFab.Internal.CallRequestContainer reqContainer) [0x00000] in <00000000000000000000000000000000>:0 at PlayFab.Internal.PlayFabUnityHttp+<Post>d__12.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) PlayFab.Internal.<Post>d__12:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: currently not available on il2cpp Line: -1)
This is the API response
. playfabapi.com/Client/LoginWithCustomID?sdk=UnitySDK-2.113.210830 Response:
{"code":200,"status":"OK","data":{"SessionTicket":"E04D539DD8494332--A22A7CAE63D64F6B-18AC3-8D98325FACBD8DF-EWWAGcSyR53S1LL+jCABjN77KCvGwzobizxFuWSevDg=","PlayFabId":"E04D539DD8494332","NewlyCreated":true,"SettingsForUser":{"NeedsAttribution":false,"GatherDeviceInfo":true,"GatherFocusInfo":true},"EntityToken":{"EntityToken":"NHxGUDIycHFHZTlYSG1sbzhCVTVjOWxTYUdNYWROUktjM2hXTUFxdmpoUjI0PXx7ImkiOiIyMDIxLTA5LTI5VDA4OjQ4OjU5LjQzMjc3NzVaIiwiaWRwIjoiQ3VzdG9tIiwiZSI6IjIwMjEtMDktMzBUMDg6NDg6NTkuNDMyNzc3NVoiLCJpZGkiOiJjZjIwYTA0Ny1iMWU3LTRjNmYtYWVmYi01ZTZiMGIwYTBmNWUiLCJoIjoiREQxQjI0QzMzM0Q5NDBEQiIsImVjIjoidGl0bGVfcGxheWVyX2FjY291bnQhRUI4N0ZBMENEOTdENTEwNi8xOEFDMy9FMDRENTM5REQ4NDk0MzMyL0NCNjUwRUQ3NkYzM0M1REMvIiwiZWkiOiJDQjY1MEVENzZGMzNDNURDIiwiZXQiOiJ0aXRsZV9wbGF5ZXJfYWNjb3VudCJ9","TokenExpiration":"2021-09-30T08:48:59.432Z","Entity":{"Id":"CB650ED76F33C5DC","Type":"title_player_account","TypeString":"title_player_account"}},"TreatmentAssignment":{"Variants":[],"Variables":[]}}}
Answer by Gosen Gao · Sep 30, 2021 at 09:43 AM
First, the PlayFabSimpleJson has been replaced by PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer), you may try it to see if this issue still happens. For more information, please refer to https://community.playfab.com/questions/24205/json-parsing-issues.html.
“Object reference not set to an instance of an object” is a general error which is often caused by something missing. I can’t reproduce this issue, can you figure out in which step does this error occur?
Hi, I haven't changed the default serializer plugin, but PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer) returns SimpleJson
plugin = this.CreatePlugin<PlayFab.Json.SimpleJsonInstance>();
It only happens in Windows and WebGL builds and never in editor. It might be happening in other builds as well but I haven't tried them yet. Both IL and Mono backends has this issue.
Here's the line that throws the null reference:
Assets\PlayFabSDK\Shared\Internal\SimpleJson.cs:1468
and here's what I do to get the NullReference
PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest { CreateAccount = true, CustomId = Guid.NewGuid().ToString() },OnLoginSuccess, OnPlayFabError);
I didn’t see anything about SimpleJson in your LoginWithCustomID call. So I can’t reproduce this issue. Would you mind providing us some detailed code on how and where you are using SimpleJson for further research?
I'm not using PlayFab's JSON stuff anywhere, PlayFab uses it internally to deserialize API responses.
Time limited store 1 Answer
[UE4] Crossplatform SDK compile errors 2 Answers
Steam Login (Wrong AppID or Publisher ID)? 1 Answer
How can i signin with google play and playfab,How can I sign in with the new google play plugin. 1 Answer
KeyNotFoundException: The given key was not present in the dictionary. 2 Answers