question

DH Kim avatar image
DH Kim asked

NullReferenceException when getting photon token

I'm trying to do authentication with photon unity network and it throws error code as below.

got the script from this link

https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/photon/quickstart

NullReferenceException: Object reference not set to an instance of an object PlayFabAuthenticator.RequestPhotonToken (PlayFab.ClientModels.LoginResult obj) (at Assets/Scripts/PlayFab/PlayFabAuthenticator.cs:51) PlayFab.Internal.PlayFabHttp+<>c__DisplayClass23_0`1[TResult].<_MakeApiCall>b__1 () (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:217) PlayFab.Internal.PlayFabUnityHttp.OnResponse (System.String response, PlayFab.Internal.CallRequestContainer reqContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:245) UnityEngine.Debug:LogException(Exception) PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:249) PlayFab.Internal.<Post>d__12:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:188) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)

Authentication
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DH Kim avatar image DH Kim commented ·

this is the console logs

0 Likes 0 ·
log.jpg (44.3 KiB)

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

This error happens in line 51:

PhotonApplicationId = PhotonNetwork.PhotonServerSettings.AppID

Therefore, I am suspecting that the AppID in PhotonServerSettings is not properly configured, could you please take a look it to see if that's the case? If that's the case, maybe you should try resetting the PUN setup following this sectionl: Setting up Unity Project

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.