Search Unity

  1. We have added dedicated sub-forums for UNet, the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice
  2. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Resolved Access NetworkManager after switching scenes?

Discussion in 'MLAPI' started by nhulston, Jun 14, 2021.

  1. nhulston

    nhulston

    Joined:
    Nov 26, 2019
    Posts:
    3
    How do I access the NetworkManager after switching scenes? I'm currently switching the scene with:
    Code (CSharp):
    1. NetworkSceneManager.SwitchScene(mySceneName);
    but then the clients/host can't access the NetworkManager after that because obviously, the NetworkManager game object was in a different scene.
     
    Picaresque likes this.
  2. luke-unity

    luke-unity

    Unity Technologies

    Joined:
    Sep 30, 2020
    Posts:
    143
    The NetworkManager by default should mark itself as "DontDestroyOnLoad" and will persist across scene changes. You should be able to access the NetworkManager via `NetworkManager.Singleton`.
     
    nhulston likes this.
unityunity