waiting room countdown trouble
Options
Hello all, I'm having a little trouble on sending countdown timer with RPC.
I have a waiting room which all connected (to the room) players gather in list. So when Player 1 creates room and waits other players to join. Until 60 sec countsdown. Debug.Log works but timer starts to down on each player individually
I have a waiting room which all connected (to the room) players gather in list. So when Player 1 creates room and waits other players to join. Until 60 sec countsdown. Debug.Log works but timer starts to down on each player individually
using UnityEngine; using System.Collections; using UnityEngine.UI; public class TestLobby : MonoBehaviour { public PhotonView pv; public float timer = 60f; public Text t; void Start () { } void Update () { if (PhotonNetwork.inRoom) { if (PhotonNetwork.isMasterClient) { pv.RPC ("ShowTimer", PhotonTargets.All); Debug.Log ("Chek for sending an RPC"); } } else { timer = 60f; } } [PunRPC] public void ShowTimer () { timer -= Time.deltaTime; t.text = "Game Begins In: " + timer.ToString ("f0"); Debug.Log ("Check for receiving an RPC"); } }
0
Best Answer
-
Never mind! I solved. Hope Photon Engineers will update all PUN demos with Unity's new UI. Thanks to all10
Answers
-
Another example that i'm trying
numbers counts down on MasterClient but others are 0using UnityEngine; using System.Collections; using UnityEngine.UI; public class TestLobby : MonoBehaviour { public PhotonView pv; public float timer = 60f; public Text t; float countDown; void Start () { } void Update () { if (PhotonNetwork.inRoom) { if (PhotonNetwork.isMasterClient) { countDown = (timer -= Time.deltaTime); pv.RPC ("ShowTimer", PhotonTargets.All); Debug.Log ("Chek for sending an RPC"); } } else { timer = 60f; } } [PunRPC] public void ShowTimer () { t.text = "Game Begins In: " + countDown.ToString ("f0"); Debug.Log ("Check for receiving an RPC"); } }
0 -
Never mind! I solved. Hope Photon Engineers will update all PUN demos with Unity's new UI. Thanks to all10
-
How did you solved it?NomadicWarrior said:Never mind! I solved. Hope Photon Engineers will update all PUN demos with Unity's new UI. Thanks to all1
0 -
sorry I don't remember. if you still need this I can explore again
0 -
Yeah that would be great if you can post it0