PUN and Time.timeScale = 0

Options
Just wanted to say that I spent two days trying to debug a mysterious case of PunRPC's and Events not transferring between clients in game because apparently Photon stops dispatching messages when Time.timeScale = 0 and you have a wonderful case of -1 by default in the varable PhotonNetwork.MinimalTimeScaleToDispatchInFixedUpdate which makes no sense at all.
So if any unfortunate soul would stumble on this —
TL:DR: check your timeScale.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited October 2019
    Options
    Hi @Net,

    Thank you for choosing Photon!

    If you want to keep dispatching commands even if Time.timeScale is 0; set PhotonNetwork.MinimalTimeScaleToDispatchInFixedUpdate to 0. That's why it was introduced for in 2.14, as you can read in the version history:
    Added: Option to dispatch incoming messages, even if Time.timeScale = 0: PhotonNetwork.MinimalTimeScaleToDispatchInFixedUpdate. It defaults to not being used.

    Maybe we should add this to the online documentation.
  • Somin
    Options

    Thanks for posting about this. Thanks to you I only spend, like half a day on this :) <3

    I'm curious though what the usecase is for NOT wanting to update messages when the timescale is 0... In my case it was roomproperties that were not updated. I can't imagine a case where this is the intended behaviour.

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options

    Hi @Somin,

    Thank you for choosing Photon!

    Not sure about use cases but we kept the default behaviour for backward compatibility.

    Maybe not everyone relies on all PUN features when the game is paused.