Search Unity

Third Party Photon Pun update int to MasterClient int?

Discussion in 'Multiplayer' started by getmyisland_dev, Jul 23, 2021.

  1. getmyisland_dev

    getmyisland_dev

    Joined:
    Dec 22, 2020
    Posts:
    100
    (I'm using Photon not Unity Multiplayer)

    Like the title says I want to update an int from a client, so it has the same value as the MasterClient.

    Here is a example of what I want to do:
    Code (CSharp):
    1. if(!PhotonNetwork.IsMasterClient)
    2.         {
    3.             currentLevel = PhotonNetwork.MasterClient.currentLevel;
    4.         }    
    This code of course is not working its just a visualization of what I want to do.

    The currentLevel int gets defined by Random.Range, thats why I cant can't just sync this.

    I would really appreciate if you could tell me how to do something like this.
    Thanks in advance.
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068