Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved [Resolved] How to restart NetworkManager properly?

Discussion in 'Netcode for GameObjects' started by wubdproject, Dec 1, 2021.

  1. wubdproject

    wubdproject

    Joined:
    Oct 31, 2021
    Posts:
    2
    Situation: Host, Shutdown, HostAgain
    I tried to use Shutdown(), but after another StartServer() i got exception with adding same id into connected players dictionary.
    Thank you in advance!
     
  2. lussor_unity

    lussor_unity

    Joined:
    Dec 30, 2021
    Posts:
    1
    Hi, I was wondering how you resolved this bug? Whenever I try to Host, and then shutdown, and then connect to a host it eventually times out and I lose connection.
     
    jdrandir likes this.
  3. alexander-andrianov

    alexander-andrianov

    Joined:
    Dec 19, 2022
    Posts:
    1
    @lussor_unity if someone is still searching for a possible problem and solution for it, then check your callback listeners (OnClientConnectedCallback and OnClientDisconnectedCallback), of course if you have them in your code.
    Maybe they are kinda repeating the same action twice :)
    So, the solution should be disabling this listeners right after host shutdown action.
     
    Last edited: Dec 19, 2022
    slambingo_ likes this.