- Home /
Networking - Move all players to a position? (Photon)
I'm making a level changing system and how it works is simple. It removes the map prefab from the scene, moves all players to a spawn point position and instantiates a new level prefab. It's all working apart from the moving part. How can I move every player in the room to an object's transform.position?
Answer by Captain_Pineapple · Jan 10, 2019 at 09:02 AM
Hey there,
basically since every player has control over his own player character (isMine is true), each player has to set this position in it's own instance.
This means every player has to be notified of the level change. For this you have 2 easy options: 1. Raise an event. (Only have to raise one event -> all players will receive it) 2. Use an rpc. (You have to send the rpc per photonview each, but can target players specifically)
With both ways you can give additional arguments like positions (Vectors not Transforms), Rotations, or basic types like float, int, string and so on. This should be quite easy to implement when you follow the documentation on these topics provided by photon itself.
Hope this helps.