SetUserVariables is Called before AddUser
Posted: 23 Dec 2018, 18:00
Hello everyone, we are facing a problem in our game, the SetUserVariables method is being called before AddUser in the client SDK
Here is the full story:
we are using Smartfox 2.13.4 with the latest SDK for C# unity, we are facing a problem where most user variables are null when the user reaches the lobby, but it's ONLY on our WebGL build and it's NOT consistent, so I thought it's a race condition or something, today I decompiled the client SDK and put traces every where to help me hunt the issue
I found that the method called FnSetUserVariables in SystemController class is being called before the SFSUserManager.AddUser method, which will cause the following message to be debugged as warning in the browser's console:
UserVariablesUpdate: unknown user id = xxxxx
We are doing custom login, reading some values from the DB and then we set them in the session object
later on JoinZoneEventHandler we add all values to a variables list and send use the API object to set the user vars
the last thing we do in this event handler is join the user to the lobby or the main room
we have no issues at all on mobiles phones which what got me confused and looking in the wrong direction for so long, is this a correct order to do things?
Notes:
1- if I try to debug the user variables later (after the user has settled in the lobby, after 30 seconds for example), the user is there and it has only part of the variables
2- some times there is no issue at all and it just works!
3- the user has all his variables assigned correctly in the admin tool in all scenarios
almost all web users can't play due to this issue, if you can help we will appreciate it
my thanks
Here is the full story:
we are using Smartfox 2.13.4 with the latest SDK for C# unity, we are facing a problem where most user variables are null when the user reaches the lobby, but it's ONLY on our WebGL build and it's NOT consistent, so I thought it's a race condition or something, today I decompiled the client SDK and put traces every where to help me hunt the issue
I found that the method called FnSetUserVariables in SystemController class is being called before the SFSUserManager.AddUser method, which will cause the following message to be debugged as warning in the browser's console:
UserVariablesUpdate: unknown user id = xxxxx
We are doing custom login, reading some values from the DB and then we set them in the session object
later on JoinZoneEventHandler we add all values to a variables list and send use the API object to set the user vars
the last thing we do in this event handler is join the user to the lobby or the main room
we have no issues at all on mobiles phones which what got me confused and looking in the wrong direction for so long, is this a correct order to do things?
Notes:
1- if I try to debug the user variables later (after the user has settled in the lobby, after 30 seconds for example), the user is there and it has only part of the variables
2- some times there is no issue at all and it just works!
3- the user has all his variables assigned correctly in the admin tool in all scenarios
almost all web users can't play due to this issue, if you can help we will appreciate it
my thanks