I have added some comments to the sample code:
Code: Select all
private void UserEnterRoom(User user) {
//When remote user enters our room we spawn his object.
SpawnRemotePlayer(user); //first spawn
remoteUser = user; //remoteUser becomes !=null
}
private User remoteUser = null;
void FixedUpdate() {
if (remoteUser!=null) {
SpawnRemotePlayer(remoteUser); //second spawn because remoteUser!=null
remoteUser = null;
}
}
Is it a bug? For me it works better when I remove the whole FixedUpdate() function. I am a novice when it comes to the Unity and SFS, so it may be only a my mistake, but I would like to get your opinion.