- Home /
Timer in PUN2
Hi! In my game I need to create a timer that synchronizes for all players, this Timer need to be on DontDestroyOnLoad (support scene changes) because in my game there are a lot of these scene changes. Do you know how can I do this?
Answer by ChristianSimon · Dec 04, 2018 at 01:46 PM
Hi,
the PUN 2 package contains a script called CountdownTimer. I would recommend you taking a look at this component and see how it works. You can easily modify it, to fit your needs.
Basically it works like this: a client sets a certain Custom Room Property called "StartTime". The client uses PhotonNetwork.Time, which is synchronized on all clients. Having this value, each client can calculate, how much time has passed (current time - start time). The result of this calculation can be subtracted from a fixed value, resulting in a Countdown Timer.
Your answer
Follow this Question
Related Questions
How to network a large map with 4000+ movable objects using Photon Unity Networking? 1 Answer
How to check distance between two players (photon multiplayer) 2 Answers
Player Won't Instantiate with Photon Unity Network [PUN] 0 Answers
How do I set up multiplayer? 0 Answers
How To List Rooms (PUN 2) 1 Answer