Substituting the NetworkManager component

Hello,
Our team has been working on a multiplayer game since Unity 4. We’ve been using the built-in Unity networking and we already have a class that handles Initializing/Connecting to servers, sending player data between players, switching scenes and all sorts of things. We’d like to use the new networking components and inherit our player classes from NetworkBehavior. For all this to work, do we have to actually have a NetworkManager component active in the game or can we substitute it with our Multiplayer class. From what I understood from the documentation, the new networking system does not use the Network class so methods like Network.Connect etc. do not work with UNET. If that’s correct and we CAN replace the NetworkManager with our Multiplayer class, then which API do we need to use for establishing a simple connection ? Do we use the low level transport layer to initialize servers and connect or is it something else ?

I apologize for the dumb question but from reading the documentation I couldn’t understand that.

When you want to use UNET, you have to completly change your network code, because the old system for RPC was replaced by Commands and ClientRPCs.

Yes, thanks, I already got familiar with that and this isn’t such a problem. After all we are going to be removing all of the networkviews and preplacing them with network identities and all of that. But my question is more about the NetworkManager component itself. Can we use all of the networking functions that come with UNET without the network manager itself. As I stated in my first post, we already have a network manager class who does everything we need and I was wondering if we can use it instead of UNET’s manager.

I’m not sure UNET is ready for prime time just yet.

Yes you can use the networking without it. But I would recommand inheriting from it and tweaking your existing class so it works with it.

I understand. Thanks for the answer. I will try what you said. Seems like a logical thing to do :slight_smile:

In a similar boat. In the final steps of my upgrade for http://mmofoundation.com/ . I am really disappointed with how the NetworkManager works. So many unanswered questions.

  • Why is switching scenes mandatory? what if I want the user to select the scene.
  • What if I prefer clr player objects (i.e. NetworkPlayer) instead of monobehaviours ?
  • From the extended NetworkManager how do I know if I am connected ?
  • From the extended NetworkManager how do I get a listing of players ?

I could go on. I like the new sync var, but the old networking stack was much more intuitive.

When you don’t set the online scene, you can manually change the scene by calling NetworkManager.ServerChangeScene.

What dou you mean with that?

You have to override NetworkManager.OnClientConnect for example.

You can manage your own list for example.

Everything that NetworkManager does you can do in your own script without having to inherit from it. All it is is a Utility Component that makes it easier to do some basic things.

Some of the most important classes are ClientScene and NetworkServer.

1 Like

Are you referring to making your scripts NetworkBehaviours? I opt to create my player scripts as MonoBehaviours as always and create a separate PlayerSync script which derives from NetworkBehaviour, with which I just hand off the variables I need to sync over the network. Handling it this way keeps it responsive and is easy to set up as an after-thought without modifying current scripts.

With regard to NetworkManager, it is just a convenience class to help noobs like me. You can set up everything without it. You will need NetworkTransport class to set up a manual connection.