Search Unity

"Stale connection" bug with fast play mode

Discussion in 'Netcode for GameObjects' started by Vectrex, Nov 30, 2022.

  1. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    I get this I think everytime it recompiles any script changes.
    "Error sending the message: Network ID is invalid, likely caused by stale connection 0"

    The second time I click play, it works from then on.

    I isolated it to the fast play mode. With it off it works fine.

    ps the bug reporter window could use improvement. It doesn't give me a case number and seems to sit there after it's sent with just the cancel button clickable. Did it send? I don't know.
     
  2. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Hi @Vectrex , it might be that NGO is not compatible with fast play mode, with domain reload disabled. However, in order to be sure of that, can you please share the stack trace where the error is coming from?
     
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,001
    Just my experience: I always disable Domain Reload and Scene Reload in projects and made several NGO tests (1.0 and 1.1) and none of them caused any issues because of domain reload disabled.

    I did run into issues with NGO synched from github though because not every commit is extensively tested. If you pulled NGO directly from github be sure to test with the closest commit with a version label or a versioned branch.

    And double check that none of your own code may be having issues with Domain Reload disabled, specifically look for static fields or events and also in 3rd party code your code may be making use of.
     
  4. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    It's the standard package from packages. I never use statics, only for singletons which should work fine.
    It should be simple for NGO to support fast play, so I hope they add it.
     
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,001
    I really don‘t think this is an NGO issue. Your singletons are properly being reset as described in the manual notes for domain reload? And if you do reset that singleton, does it also null any references it may be holding, especially anything network related?

    Do you get any NetworkManager duplication when changing scenes?