question

wayneprim90 avatar image
wayneprim90 asked

Null Reference Exception on GetPlayerCombinedInfo()

I am working with GetPlayerCombinedInfo() and I keep getting a null reference exception...

Here is my code:

 //Connect using Play Fab Login with Device ID
varloginRequest = newLoginWithIOSDeviceIDRequest
{
    CreateAccount = true,
    DeviceId = SystemInfo.deviceUniqueIdentifier
};


PlayFabClientAPI.LoginWithIOSDeviceID(loginRequest, (loginResult) => {
    //Successfully logged in.
    debugText.text += "\n > Logged In. Fetching User Info...";
    var accountInfoRequest = newGetPlayerCombinedInfoRequest
    {
       InfoRequestParameters = {
          GetUserVirtualCurrency = true,
          GetUserAccountInfo = true
        }
    };


    PlayFabClientAPI.GetPlayerCombinedInfo(accountInfoRequest, (result) => {
        debugText.text += "\n > Fetched Data: " + result.InfoResultPayload;
    }, (error) => {
        debugText.text += "\n > Error fetching info: " + error.GenerateErrorReport();
    });
 }, (loginError) => {
    //Error logging in... Display this error
    debugText.text += "\n > Error logging in. Reason: " + loginError.GenerateErrorReport();

});

The error is as follows:

NullReferenceException: Object reference not set to an instance of an object
WP3Sandbox.Connection.<Awake>m__0 (PlayFab.ClientModels.LoginResult loginResult) (at Assets/Game/Scripts/Connection.cs:34)
PlayFab.Internal.PlayFabHttp+<MakeApiCall>c__AnonStorey0`1[PlayFab.ClientModels.LoginResult].<>m__1 () (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:187)
PlayFab.Internal.PlayFabWww+<MakeApiCall>c__AnonStorey1.<>m__0 (System.String response) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:97)
UnityEngine.Debug:LogException(Exception)
Account Management
10 |1200

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

1 Answer

·
pfnathan avatar image
pfnathan answered

Based on the callback, it is indicating that you have an exception on your code at this file "Assets/Game/Scripts/Connection.cs:34". This is your file that needed to be debugged.

Please check your debugText or debugText.text to see if those are defined.

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.