Moving multiple players to other scene
Options
Hi all, im new using PUN and i have a problem when I try to move all the players to another scene.
I think it must be easy to solve, but i dont really know how.
I have a scene in unity, there are a few spawn points in where the players join it
Im using this - PhotonNetwork.JoinRandomRoom(); and all the players joined the same room (i guess)
In the scene there are two type of players (admins and normal players), and I just want when an admin player press a button, the scene change for all the people who are in and they join the other room at the same time (sync).
I tried to PhotomNetwork.LoadLevel but I dont really know what that does and its not working.
Please, any kind of help will be a great help to me, im a bit lost.
Thanks - Jhin
I think it must be easy to solve, but i dont really know how.
I have a scene in unity, there are a few spawn points in where the players join it
Im using this - PhotonNetwork.JoinRandomRoom(); and all the players joined the same room (i guess)
In the scene there are two type of players (admins and normal players), and I just want when an admin player press a button, the scene change for all the people who are in and they join the other room at the same time (sync).
I tried to PhotomNetwork.LoadLevel but I dont really know what that does and its not working.
Please, any kind of help will be a great help to me, im a bit lost.
Thanks - Jhin
0
Best Answer
-
Hi @Jhin_Thomas_Tobias,How can I create a room as a masterClient?
The client who creates the room is automatically the MasterClient until he leaves the room or another MasterClient is set.Other option from non-master client is sending a RPC to a master asking it to do an action. But I have no idea about how to do it.
You can call RPC(...) function on your attached PhotonView component. You can find more information and an easy to understand example on the documentation here.5
Answers
-
- Before the execution of this line(
PhotomNetwork.LoadLevel
), please writePhotonNetwork.automaticallySyncScene = true;
- The master client executes this line (PhotomNetwork.LoadLevel
). It loads all players into the scene
1 -
Thank you Kurtav your answer was very helpfull! I can understand how PhotonNetwork.automaticallySyncScene = true works now . But It must be called by the MasterClient...Kurtav said:- Before the execution of this line(
PhotomNetwork.LoadLevel
), please writePhotonNetwork.automaticallySyncScene = true;
- The master client executes this line (PhotomNetwork.LoadLevel
). It loads all players into the scene
How can I create a room as a masterClient? I read that you can only ask if one client is PhotonNetwork.isMasterClient ...
Other option from non-master client is sending a RPC to a master asking it to do an action. But I have no idea about how to do it.
Any kind of help will be a great help to me. TY Jhin.
0 -
Hi @Jhin_Thomas_Tobias,How can I create a room as a masterClient?
The client who creates the room is automatically the MasterClient until he leaves the room or another MasterClient is set.Other option from non-master client is sending a RPC to a master asking it to do an action. But I have no idea about how to do it.
You can call RPC(...) function on your attached PhotonView component. You can find more information and an easy to understand example on the documentation here.5