How to implement network manager (among others) with my scripts rather than the premade component?

Hi,

Since Unity made Network Manager has some game logic in it in player respawn and scene change, I need to change/override those to fit my game’s needs.

So my question is how to do so. I want to have all the network related parts and just change the game logic parts.

Cheers.

I really recommend the NetworkStarter sample Unet project. It was pretty easy to integrate into my existing game, and has a class that extends NetworkManager with some functions already overwritten. It’s got some good starting principles for GUI interface stuff as well and I found it easily mod-able.

Code in the attachments of the first post here:

Edit: Sorry, I meant that it extends NetworkLobbyManager, which is still useful to see in principle. But also great to use as-is if you actually need a lobby.

2 Likes

Thanks. Is scene change necessary? How can I alter it? My game has several maps that player should be able to choose on their preference but NetworkLobby only accepts two scenes, one for offline and one for online.

Isn’t it possible to alter the game scene at runtime?

Yes with NetworkManager.ServerChangeScene, but that’s not my question here. Please read the first post as well.

Sorry, what I meant is that you can probably set the properties playScene (for NetworkLobbyManager) and onlineScene (for NetworkManager) while you are in the lobby scene. As for your question, extending the existing manager and overriding functions… By the way, it is always helpful to peek into the code of the UnityEngine assembly to know how things are done.

How can I “peek into” NetworkManager (and other components like NetworkTransform) ?

If you’re using MonoDevelop it’s as easy as opening the View->Assembly browser and finding the UnityEngine.Networking assembly in the tree on the left (not the assembly UnityEngine and its namespace Networking). In the case of Visual Studio… I don’t even know if there is an equivalent… anyone?? You have the option to use another program called ILSpy.

I think you mean using NetworkManager.singleton to access it.