PUN RaiseEvent in FixedUpdate()
liorium
✭
Hello!
I'm experiencing so many disconnects in the game.
In the game there are 2 players in a room. Let's say playerA and playerB, if it's playerA turn when he makes a move then he have to tell 20 objects' position to playerB so i RaiseEvent in the FixedUpdate() with the content of Vector3[] of every objects' position, rotation, and velocity and sendReliable = true. I tried to make some delay by counter.
Is it because of the data sent are too much and sendReliable = true?
Thanks in advance.
I'm experiencing so many disconnects in the game.
In the game there are 2 players in a room. Let's say playerA and playerB, if it's playerA turn when he makes a move then he have to tell 20 objects' position to playerB so i RaiseEvent in the FixedUpdate() with the content of Vector3[] of every objects' position, rotation, and velocity and sendReliable = true. I tried to make some delay by counter.
void FixedUpdate() {
if(a==1)
{
//RaiseEvent Here
}
a++;
ifa>8)
a=0;
}
Is it because of the data sent are too much and sendReliable = true?
Thanks in advance.
0
Comments
-
Hi @liorium,
if you haven't done this already, you can add thevoid OnConnectionFail(DisconnectCause cause)
callback and check out the DisconnectCause. If it is a DisconnectByClientTimeout, you can have a look at the Analyzing Disconnects documentation page and see, if this helps you. If it is a DisconnectByServerLogic, you are probably sending too much data.
Besides that, sending the position of 20 objects shouldn't be a problem, if you don't send this information too often. Since this seems to be a turn based game, do you actually need to send from the FixedUpdate function? Wouldn't it work, to just send one message after the players fas finished his turn?0 -
Hi @Christian_Simon
Thanks for your answer.
I have checked the DisconnectCause and it's a DisconnectByClientTimeout.
I think i need to send it from fixedupdate because i need all the objects position to be synchronize with other player. After the turn finished, the object can push another objects which i think can make a difference in the physics with other device and the positions won't be the same.0 -
Have you tried adding a PhotonTransformView, PhotonRigidbodyView or a custom OnPhotonSerializeView solution to the objects instead of using RaiseEvent?0
-
I will try to use your suggestions. Thanks.0