- Home /
Pick a random number, then synchronise it? (Unity Photon)
Okay, im gonna get right into my problem. What i want to do is, when all but one players are dead and it says who won and so on, i want to pick a random number and instantiate a map layout into the game based off that number. How can i make sure the number is the same for each person in the room?
Answer by Captain_Pineapple · Jan 10, 2019 at 03:39 PM
Hey there, there are 2 options for this: either decide on a number on for example your master client and send it to all others. (RPC or event) or you create a special instance of a random generator for this that you feed with the same number as seed for all players. This will require you to make sure that the instation seed is the same for all participants - so a event/rpc as initialization is necessary as well but here only once. After this whenever someone calls on the random generators "next" number it should be the same. (I did this in my game to make sure the random spread of weapons is always the same for all players)
Hope this helps, if something was not clear feel free to ask.
Your answer
Follow this Question
Related Questions
Trying to get Photon.PlayerProperties to return not null 0 Answers
Best way to place a name tag over a player? 1 Answer
What's the best method to implement multiplayer on a Billiard game ? 1 Answer
photon server cant lunch the "loadbalancing". 0 Answers
`PhotonNetwork.Time` is not changed in every `FixedUpdate` call 0 Answers