[UNITY PUN2] Sending network data when Time.timeScale is at zero

In my game, when the round ends, I set Unity's timeScale to 0 to freeze the background and overlay a UI. When the master client, presses continue I use PhotonNetwork.LoadLevel. However, this level change is never communicated to the other clients. I've tried using RaiseEvent to tell the clients to reset their timescale back to 1 and I've tried using RPCs. Is there any way to send network data while Time.timeScale is zero?

Thanks in advance!


  • I am having this same issue. In my case, I am starting out a loaded level as paused(0 timescale) until all players are loaded. But player properties are not synchronized when Time.timeScale is 0. I'm not sure, but I think this used to work in PUN 1.
  • Any workarounds for this issue?
  • jRocket said:

    Any workarounds for this issue?

    It's not ideal, but I set the time scale to a 0.01 and then back to zero every couple frames to check for any network changes. I'm fairly certain that a previous version of PUN2 didn't have this issue. Hopefully, a PUN2 dev will look into a proper fix.
  • JohnTubeJohnTube mod
    edited May 21
    Hi @TheSLAP,

    Thank you for choosing Photon!

    What is not working exactly when Time.timScale is set to zero? (Level sync, is that it?)
    What is the expected behaviour and current behaviour?
    How can we reproduce with minimal steps?

    Is there any way to send network data while Time.timeScale is zero?
    Actually PUN uses Time.realtimeSinceStartup which is independent from Time.timeScale. See "PhotonHandler.cs".

    Hi @jRocket,

    But player properties are not synchronized when Time.timeScale is 0
    How do you set player properties? and what made you say this and come to this conclusion? how did you test this?


    What PUN version and Unity version do you use to reproduce this?
    Does this happen in editor and in build? which platforms?
  • @JohnTube I had this happen in my own game while switching scenes and waiting for other players to switch. I have a matchmaking/lobby unity scene, and whenever the players are ready, an RPC is sent out to request that each client change the scene to the game scene. Then, whenever the scene is loaded, I set a player prop to indicate that the player has loaded the scene, and set the Time.timescale to 0 until all players have set that prop. However, that player property is never replicated over :( I'm not sure if it's an issue sending it or receiving it.

    The Asteroids demo does the same thing with player props, and I was able to reproduce my issue by setting Time.timescale to 0 in the Start() method of the AsteroidsGameManager. When doing that, OnPlayerPropertiesUpdate is never called so the game doesn't know if the other player has loaded the scene.

    I using PUN 2.12 on Unity 5.6 on Windows, testing with 1 client on the Editor and 1 on a development build. Hope that description helps.
  • JohnTubeJohnTube mod
    edited June 10
    Hi @jRocket,

    According to this, moving code from FixedUpdate to Update in PhotonHandler is a solution to the Time.timeScale = 0 problem but may have some drawbacks.
  • Maybe another thread, but photon clients don't receive PunRPC calls when their timeScale is 0
  • We have faced the same issue, but after we changed it to Update, it started working fine. As you have mentioned, what are drawbacks of doing so? Please explain. Will you fix it in future updates?
  • @Tobias added a solution for this issue which will be released in next PUN 2.14 soon.
Sign In or Register to comment.