Setting variable and send it to players (Broadcast)

Options
Hello,

I'm trying to achieve the following method, create a random number and assign it to variable. This variable should be passed to all players.

My current situation is that the Player has the random generation method and once it initialized, two different number are generated. I tried to control it through RPC but I can see that it send to each other different number as well.

For me it doesn't need to be from a certain player. Whoever execute the method first or last shall send it to the other. I need the same number for the both of them.

Any idea how to achieve that ?

Comments

  • Baleegh
    Options
    Forgot to mention that I tried to OnPhotonSerializeView
    if (stream.IsWriting) { if(PhotonNetwork.IsMasterClient) stream.SendNext(qus); } else { if(!PhotonNetwork.IsMasterClient) qus = "" + stream.ReceiveNext(); print("receving" + qus); }

    But it seems the value of qus is always null, and didn't receive a thing. I tried removing the PhotonNetwork.IsMasterClient but nothing changed