The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

PhotonNetwork.SetMasterClient() not working

fenyce_m
2021-03-21 17:28:57

Hello,

I am trying to understand why the Master Client doesn't switch when I call SetMasterClient.

I have two Android mobile devices. They run the same code apart from one bool variable which I use to distinguish between the two.

I tell one of the two to set itself as master client by doing a check on that bool variable but although SetMasterClient returns true, the network doesn't acknowledge the switch

I also tried to turn this into an RPC which I call on the master client from another client as I thought maybe only the master client can force a mnual switch but the result doesn't change.

What am I doing wrong?

Many thanks!

Comments

fenyce_m
2021-03-23 09:14:13

I found out what the problem was, I wasn't waiting enough time for the master client to switch. Implementing the OnMasterClientSwitched callback clarified when the event occurred. I found this youtube clip helpful https://www.youtube.com/watch?v=yrB7Hyh2BE4&ab_channel=FirstGearGames

Back to top