Search Unity

NetworkManager access help

Discussion in 'Multiplayer' started by Bigbeef, Mar 30, 2017.

  1. Bigbeef

    Bigbeef

    Joined:
    Apr 6, 2013
    Posts:
    31
    I'm trying to create a script that searches for any active games on the LAN, and if there isn't any, to start the game as a Host, and if there is one, to start the game as a client and connect to that host, to make it a lot faster/easier to start up and connect to a LAN game.

    My issue is that most of the functionality I seem to need is in the NetworkManager class, but I can't access any of it.

    https://docs.unity3d.com/ScriptReference/Networking.NetworkManager.html

    A lot of tutorials do things like NetworkManager.singleton.StopClient(); but I can't do that. My NetworkManager doesn't have a singleton member. I can't access any of the NetworkManager functionality.

    Basically, if I type: NetworkBehavior.singleton

    it says NetworkBehavior does not contain member called singleton


    What am I missing? How come other people can access NetworkManager in scripts and I can't?

    I feel like a complete noob, this is such basic stuff, but I've never had this issue before. Normally I just look at the documentation, add the required headers and code away. Not sure what the issue is here, any help would be nice.
     
    Last edited: Mar 30, 2017
  2. Bigbeef

    Bigbeef

    Joined:
    Apr 6, 2013
    Posts:
    31
    We discovered the issue. A few months back I had added a script from an import package that I never used. The script was named NetworkManager. It was a name collision issue. Sorry for the dumb question lol.