Making variable local to Master client

Options
Hey, I'm working on a multiplayer game in which the number of max players per room is 2. there are different rounds for a match and it works perfectly. Photon is great. but my only problem is I want master client to select the number of rounds and when these rounds completes the result panel shows on both the screens. But in this process i'm unable to declare an integer limited to the scope of master and the client can only get it with the reference of master.

Or simply how can i get a component of a master client i.e GetComponent(); of a master client.

Comments

  • Hi @SaadSalman,

    But in this process i'm unable to declare an integer limited to the scope of master and the client can only get it with the reference of master.


    I honestly don't get the reason why you want to have this behaviour. Do you want to forbid that a non-MasterClient can modify this value? I guess an inefficient RPC- or RaiseEvent-construction (client asks MasterClient to send him this value) will work, but is not a good solution.

    Maybe you can use the Custom Room Properties or Player Properties and implement the matching callback whereat you check if the modification has been requested by the MasterClient somehow.
  • hey thanks for your response. Actually the scenario is that master player sets the number of rounds and i want the client player to use the same number of rounds and upon match completion both the players should have the dialogue that you have won x/total rounds.
  • In this case Custom Room Properties are the best solution as far as I would say.