I'm working on a project using Unity for the client side and Java for the server side. I'm having an issue with user variables when switching rooms.
Here's what's happening: if I'm in the same room as another user and they update a variable called "hold", everything works well. But when I change rooms, and that same user deletes their "hold" variable (sets it to null on the server), and then follows me into my new room, my client still shows that this user has the "hold" variable.
This issue doesn't seem to clear until I completely restart my Unity project. After a restart, the user is correctly shown as not having the "hold" variable. The strange thing is, the user who owned the "hold" variable can't see it in their client after they delete it, but if any user who left the room before the deletion comes back, they still see the deleted "hold" variable.
This is my code in my Unity project, so you can see I don't do anything strange:
Code: Select all
private void onUserEnterRoom(BaseEvent evt)
{
User user = (User)evt.Params["user"];
this._room.AddPlayer(user);
}
I'm using the user.GetVariable() to get the data.
And this is my server code when removing the hold variable:
Code: Select all
SFSUserVariable holdVar = new SFSUserVariable("hold", null);
holdVar.setNull();
this.getApi().setUserVariables(sfsUser, Arrays.asList(holdVar));
Hope you can help!