Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Pusselbit · Jan 29, 2018 at 06:00 PM · multiplayermultiplayer-networkinglobby

NetworkManager.Shutdown does not behave as advertised - HOW do you completely reset all UNET functionality?

My issue is really very simple, and I've seen other people with similar problems, however no real solution that works for me.

I have a game with three scenes: MainMenu, Lobby, and Game.

Lobby-scene is used as a simplified "find quick game"-lobby with a NetworkManager deriving from NetworkLobbyManager. Game-scene works both in multiplayer mode and in singleplayer mode. MainMenu-scene should be self explanatory.

I'm having issues when leaving to MainMenu after initializing the NetworkManager system. If I just leave without trying to destroy network functionality I have issues when returning to Lobby and there seems to be a lot to keep track of and this solution feels generally unstable.

So I think "fine, I'll just completely reset all network functionality." The flow works perfect when I enter Lobby from MainMenu the first time, so if I can just return to that state (a "clean" MainMenu), then my problems are gone.

This is pretty much how NetworkManager.Shutdown is explained in the docs):

"Shuts down the NetworkManager completely and destroy the singleton. This is required if a new NetworkManager instance needs to be created after the original one was destroyed. The example below has a reference to the GameObject with the NetworkManager on it and destroys the instance before calling Shutdown() and switching scenes."

 Destroy(NetworkManagerGameObject);
 NetworkManager.Shutdown();
 Application.LoadLevel("empty");

The problem with this is that it doesn't work. This is my code:

     public void ReturnToMainMenu()
     {
         if (IsFading) return;
         IsFading = true;
         _fader.FadeOut(0.7f, () =>
         {
             Destroy(NetworkManager.singleton.gameObject);
             NetworkManager.Shutdown();
             SceneManager.LoadScene("MainMenu");
             _fader.FadeIn(0.7f, () =>
             {
                 IsFading = false;
             });
         });
     }

What happens is that a new NetworkManager is created when I enter MainMenu and starts doing all kinds off stuff, which really messes up the state of things.
I just really, really, really would like to enter a clean, Unet-less state after once initiating the NetworkManager machine. Is this possible? If not, why?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by unity_P4FJ0RKxb5fRVA · Jul 03, 2019 at 01:33 PM

Hey @Pusselbit, did you find an answer to this issue ? I am currently facing the exact same problem many thanks!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

128 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[UNET] LobbyManager - OnLobbyServerSceneLoadedForPlayer() not executing for clients 1 Answer

OnStart ___ vs OnLobbyStart ___ methods from NetworkManager and NetworkLobbyManager 1 Answer

NetworkLobbyPlayer SendNotReadyToBeginMessage doesn't exist? 1 Answer

Create Multiplayer lobby sytem 0 Answers

[Unet] NetworkManager singleton auto-destruction 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges