question

emaalouly1 avatar image
emaalouly1 asked

Unity PlayFabWWW Registration Error

Hello,

I have recently upgraded to the latest playfab unity sdk from GitHub:

https://github.com/PlayFab/UnitySDK

The registration now throws error about usersettings being null.

I have looked into the new registration code in PlaFabWWW.cs and found some wrong code and fixed it, but i'm not sure if I messed up with something. Here's the code that I have changed to fix it:

#if !DISABLE_PLAYFABCLIENT_API


UserSettings userSettings = null;
var res = result as LoginResult;
var regRes = result as RegisterPlayFabUserResult;


if (res != null) {

userSettings = res.SettingsForUser;
AuthKey = res.SessionTicket;


} else if (regRes != null) {

userSettings = regRes.SettingsForUser; // Change res to regRes
AuthKey = regRes.SessionTicket;

}

if (userSettings != null) {

//AuthKey = res.SessionTicket; // Commented this for it has already been instantiated above and throwing errors if it is registration

#region TrackIDFA...

#endregion

}

#endif

This has made it work properly so far, but is this how it is supposed to be? or does this mess up the part inside the userSettings' if condition?

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.

1 Answer

·
1807605288 avatar image
1807605288 answered

I believe you are right.

I've taken your change and posted it for code review with the author of that file. Your fix, or something very like it, will be in the next version, (probably) next week.

Thanks!

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.