Page 1 of 1

SetUserVariables is Called before AddUser

Posted: 23 Dec 2018, 18:00
by Hassan Khallouf
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

Re: SetUserVariables is Called before AddUser

Posted: 24 Dec 2018, 08:53
by Bax
Thank you for reporting.
We will investigate the issue during the next days and let you know.

Re: SetUserVariables is Called before AddUser

Posted: 24 Dec 2018, 10:43
by Hassan Khallouf
thanks Bax, let me know if there is any info you need to help
by the way the problem is WAY LESS frequent on firefox, but it still happens sometimes

Re: SetUserVariables is Called before AddUser

Posted: 24 Dec 2018, 11:04
by Lapo
Hassan Khallouf wrote:thanks Bax, let me know if there is any info you need to help
by the way the problem is WAY LESS frequent on firefox, but it still happens sometimes

Ouch. This might make the investigation more difficult. Which browsers did you use for testing? And which one seems to be affected the most?

Thanks

Re: SetUserVariables is Called before AddUser

Posted: 24 Dec 2018, 13:23
by Hassan Khallouf
Chrome and firefox,
it happens on chrome most of the times, so our game is kinda completely broken if you use chrome

Re: SetUserVariables is Called before AddUser

Posted: 03 Jan 2019, 10:10
by Hassan Khallouf
Any clues so far? :D

Re: SetUserVariables is Called before AddUser

Posted: 03 Jan 2019, 10:29
by Bax
We yet can't reproduce the issue.
Can you please show how you execute the steps you described earlier?

- 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