Domain reload

It's most likely not a big issue to most people, but everything in my project is built on the disabled domain reload, which was implemented by unity pretty long ago, and if i recall correctly all asset store publishers were notified to add support to their assets. PUN seemed to ignore it, so it forces me to enabled domain reload which hinders the production speed for me.
I need some response from developer on the issue. Domain reload is a rudiment from the past, a hack to allow easier transition for new unity users, at the cost of development time.
Properly architected project not relying on domain reload goes into play mode instantly, compared to several seconds (10+ for larger projects). When will pun support it?

Comments

  • TobiasTobias admin
    edited July 2020
    It's not yet supported. Disabling domain reload means we have to do a significant amount of initialization.
    We plan to support it in PUN 2. The speed-up would be more than welcome.

    While it was added to Unity a while ago, new features take a while to become stable. We deliberately support stable versions of Unity in favor for bleeding edge features which cause issues on their own.

    Disabling Domain Reload is an experimental feature. It may be labeled stable in 2020.2.
  • Tobias wrote: »
    It's not yet supported. Disabling domain reload means we have to do a significant amount of initialization.
    We plan to support it in PUN 2. The speed-up would be more than welcome.

    While it was added to Unity a while ago, new features take a while to become stable. We deliberately support stable versions of Unity in favor for bleeding edge features which cause issues on their own.

    Disabling Domain Reload is an experimental feature. It may be labeled stable in 2020.2.

    Unity 2020.2 is released and the configurable Enter Play Mode is no longer experimental. Does Photon have a timeline for supporting the Disabled Domain Reload?

  • I have been using no domain reload for fast transition while developing on PUN for a while, can someone please tell me the drawbacks of this? I'm not aware if I had issues with that.. I know all static initializations will stay the same but why did I not have issues?
  • I have been using no domain reload for fast transition while developing on PUN for a while, can someone please tell me the drawbacks of this? I'm not aware if I had issues with that.. I know all static initializations will stay the same but why did I not have issues?

    I get a ton of NullReferenceExceptions from Photon when disabling domain reload.
    NullReferenceException: Object reference not set to an instance of an object
    Photon.Pun.PhotonNetwork.AddCallbackTarget (System.Object target) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:84)
    Photon.Pun.MonoBehaviourPunCallbacks.OnEnable () (at Assets/Photon/PhotonUnityNetworking/Code/PunClasses.cs:225)
    

    It seems to originate from PhotonNetwork.NetworkingClient being null, and that field is currently being set in a static block.

    I'm sure there are a number of things that would need to change even after that error is fixed, so it seems Photon cannot be used with disabled domain reloading.
  • We have the same problem. Tons of exception coming from Photon when domain reload is disabled.

    Support for this would be more than welcome. Does Photon have a timeline for this? @Tobias
  • TobiasTobias admin
    edited January 14
    If you run into issues, please update PUN 2.
    We got support for "No Domain Reload" since a while but only the latest versions got it right.

    If you encounter issues, always let us know the exact PUN 2 version you use and the version of Unity. Include Editor logs, if possible. You can mail us, to avoid exposing any data you don't want to be seen publicly: [email protected]

    After importing PUN, make sure it's up to date. There were issues with some package managers, which imported older versions (from the dl cache). Check the PhotonServerSettings file in Editor. It shows the PunVersion string.
  • DharbyDharby
    edited January 14
    Thanks @Tobias , it looks to be working. I had to ensure PhotonNetwork.OfflineMode was properly being reset via a static method:
            [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
            static void Init()
            {
                PhotonNetwork.OfflineMode = false;
            }
    

    Now all looks in order. Thanks!
  • TobiasTobias admin
    edited January 15
    Ah, ok, That can be added to the init of PUN as well.
    Edit: Let me re-phrase that. I meant to say: I will add OfflineMode to our initialization code!

    Thanks for the heads-up and confirmation of our fixes!
  • FlorianFlorian
    edited January 15
    It seems to be working with the latest version and with the fix of @Dharby. Thanks!!
  • I am setting
    PhotonNetwork.OfflineMode = true;
    
    but OnConnectedToMaster is never called. It only happens when disabling Domain Reload (works fine otherwise).

    It might be related to what Dharby was saying above and his fix. I tried it but it was creating other problems as I was to start in OfflineMode by default.
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
            static void Init()
            {
                PhotonNetwork.OfflineMode = false;
            }
    

    Any idea? Thanks!
  • As far as I can see, setting OfflineMode = false in PhotonNetwork.StaticReset() does the trick.
    But the attribute for this is now:
    RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    
    Maybe this makes a difference. It affects the timing. Even with StartInOfflineMode, I can see OnConnectedToMaster being called.
  • Offline mode did not call OnConnectedToMaster when leaving a room. This could be fixed by adding it in PhotonNetwork.LeaveRoom().
Sign In or Register to comment.