Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Two NetworkManagers

Discussion in 'Multiplayer' started by Zelek, Jun 5, 2018.

  1. Zelek

    Zelek

    Joined:
    Jun 12, 2010
    Posts:
    87
    Is there a way to have two separate Network Managers at the same time? My project allows for multiple servers to be running at the same time, and I'd like to use the second Network Manager so that the servers can communicate with each other. The HLAPI is perfect for what I need, if I could just get a second Network Manager up and running.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Server to server communication shouldn't need the syncing of all your network objects in the scene. Use NetworkServerSimple for server to server communication, and communicate through Unet Messages.
     
    Zelek likes this.
  3. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,218
    I am assuming you are wanting them to run on a separate port? If so, it is unfortauntely not possible using the standard networking manager without doing something of a hackjob. I was wanting / needing the same thing.

    https://forum.unity.com/threads/unet-networkserver-listen-of-multiple-ports.406509/

    This is pretty much the closest you will get using what is built into Unity. You can always add in your own 3rd party networking stuff to create socket connections an bind multiple ports to a single listener, though.
     
    Zelek likes this.
  4. Zelek

    Zelek

    Joined:
    Jun 12, 2010
    Posts:
    87
    Thank you both, I hadn't heard of NetworkServerSimple but it sounds like it should be perfect for what I need. Is there somewhere I can see a basic example of how to set this up? So far I've done everything with the Network Manager and HLAPI, but it looks like I can't actually create a NetworkServerSimple in the scene, so I'm a little unsure where to start.
     
  5. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,218
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847