question

Roman Rybalko avatar image
Roman Rybalko asked

PlayFabHTTP initialization (Unity SDK v2)

Hello!

If we trying access to method "PlayFabClientAPI.IsClientLoggedIn()" before making any request, will be throwing null reference exception.

This resolved by call directly PlayFabHttp.InitializeHttp() before access.

Thank you.

sdks
10 |1200

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

brendan avatar image
brendan answered

Thanks for calling this out! Another user opened this as an issue in the GitHub repository as well (that's the fastest way to make sure our tools team is aware of issues with SDKs), so we'll be fixing it for the next release.

10 |1200

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

marcowilliamspf avatar image
marcowilliamspf answered

As brendan said the fix is going out on the next release.. .but if you want to apply the fix locally.. this is what we have done..

in the PlayFabHTTP.cs file located in PlayFabSDK/Shared/Internal/PlayFabHttp

search for IsClientLoggedIn() and update the code to the following.

        public static bool IsClientLoggedIn()
        {
            return _internalHttp != null && !string.IsNullOrEmpty(_internalHttp.AuthKey);
        }
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.