OnPhotonSerializeView not updating properly [Values Pauses or jumps around
Options
So I am using the OnPhotonSerializeView to sync our following Parameters. This script is owned by Master Client
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext((float)GlobalOptions.currentNumberOfRound);
stream.SendNext(GlobalOptions.currentPrepPhase);
stream.SendNext((float)GlobalOptions.currentRoundDuration);
stream.SendNext(GlobalOptions.currentRoundEndWaitTime);
stream.SendNext(GlobalOptions.MatchEnded);
stream.SendNext(GlobalOptions.RoundEnded);
stream.SendNext(GlobalOptions.currentRoundToSwitch);
stream.SendNext((int)PlayerOptions.RedTeamWins);
stream.SendNext((int)PlayerOptions.BlueTeamWins);
}
if (stream.IsReading)
{
SyncNumberOfRound = (float)stream.ReceiveNext();
SyncPrepPhase = (float)stream.ReceiveNext();
SyncRoundDuration = (float)stream.ReceiveNext();
SyncRoundEndWait = (float)stream.ReceiveNext();
SyncMatchEnd = (bool)stream.ReceiveNext();
SyncRoundEnd = (bool)stream.ReceiveNext();
SyncRoundToSwitch = (float)stream.ReceiveNext();
SyncRedWins = (int)stream.ReceiveNext();
SyncBlueWins = (int)stream.ReceiveNext();
}
}
It works good for some time and then it gets stuck at random points
Now note this problem did not exist for all this time, and has appeared since we upgraded to PUN2
Now we have a backup code in every non master client's scripts to change host as soon as the current host's timer is not moving, this detects the synchronized version of the SyncPrepPhase /SyncRoundDuration /SyncRoundEndWait.
what is a better way to do this? or what am I doing wrong here? something updated in PUN2 that maybe I missed?
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext((float)GlobalOptions.currentNumberOfRound);
stream.SendNext(GlobalOptions.currentPrepPhase);
stream.SendNext((float)GlobalOptions.currentRoundDuration);
stream.SendNext(GlobalOptions.currentRoundEndWaitTime);
stream.SendNext(GlobalOptions.MatchEnded);
stream.SendNext(GlobalOptions.RoundEnded);
stream.SendNext(GlobalOptions.currentRoundToSwitch);
stream.SendNext((int)PlayerOptions.RedTeamWins);
stream.SendNext((int)PlayerOptions.BlueTeamWins);
}
if (stream.IsReading)
{
SyncNumberOfRound = (float)stream.ReceiveNext();
SyncPrepPhase = (float)stream.ReceiveNext();
SyncRoundDuration = (float)stream.ReceiveNext();
SyncRoundEndWait = (float)stream.ReceiveNext();
SyncMatchEnd = (bool)stream.ReceiveNext();
SyncRoundEnd = (bool)stream.ReceiveNext();
SyncRoundToSwitch = (float)stream.ReceiveNext();
SyncRedWins = (int)stream.ReceiveNext();
SyncBlueWins = (int)stream.ReceiveNext();
}
}
It works good for some time and then it gets stuck at random points
Now note this problem did not exist for all this time, and has appeared since we upgraded to PUN2
Now we have a backup code in every non master client's scripts to change host as soon as the current host's timer is not moving, this detects the synchronized version of the SyncPrepPhase /SyncRoundDuration /SyncRoundEndWait.
what is a better way to do this? or what am I doing wrong here? something updated in PUN2 that maybe I missed?
0
Comments
-
Also note it also stays stuck after switching host. And everything else syncs properly, except : currentPrepPhase,currentRoundDuration,currentRoundEndWaitTime0
-
Fixed it : It was my fault another object from the scene unrelated to the time object had their observable element missing0