The question is answered
Can one scene have two NetworkManagers?
Hello Unity Answers,
I'm working on a game where I need to have two connections in the same scene. One as a server and one as a client. I'm trying to use Unet to build a Master Server to manage all of connections.
Can one scene have two NetworkManagers?
Thanks for any and all help!
No you can't, that's not the purpose of the Network$$anonymous$$anager.
What exactly do you mean, you need two connections in the same scene, one as a server and one as a client?
The Network$$anonymous$$anager can already function as server only or client only, did you mean that or something else?
I'm needing two Network$$anonymous$$anagers in the same scene. One to connect to a server (function as a client) and the other to be a server (to allow clients to connect to it). After one of the Network$$anonymous$$anagers establishes it's connection the other doesn't seem to connect.
Well you can't. If I'm not completely mistaking, or something has changed in the last few months, they are a builtin simple support for networking out-of-the-box so to speak..
When having multiple in one scene, and you run it, you should see error messages like "there are more than one networkmanager in the scene.."
While you can run the manager as a host (client & server simultaneously) I think you need two seperate IP connections right? That is, as far as I know, not possible with the Network$$anonymous$$ananger. I'm sorry I could not understand your question the first time ;)
$$anonymous$$aybe you can do a kind of workaround making one small build be the masterserver and then make a seperate client exe? $$anonymous$$any games have it like that (Dedicated Servers).
I'm sorry I'm not much of a big help here, I haven't done networking in ages. :/
Answer by aditya · Apr 13, 2016 at 05:24 AM
Im not a Unet user but what i know is that GameObjects uses networkManagers to Receive and Send information over network, this means the objects that needs network should have a NetworkManager attached
Thanks for your reply! However, from my limited experience, when there are more than one Network$$anonymous$$anagers in a single scene (even if the Network$$anonymous$$anager is associated with different GameObjects) only one Network$$anonymous$$anager will connect.
$$anonymous$$y bad, i typed GameObject
ins$$anonymous$$d of Scene
That's wrong, you should have written "Objects that needs network should have a NetworkIdentity attached", not a Network$$anonymous$$anager. Like Pampelmuse said, there can only be one Network$$anonymous$$anager in the scene. I tried it.
Yep it sounds like I will have to figure out a different way. Thanks for replying though!
Follow this Question
Related Questions
How can I send update to all clients from one client in Multiplayer game in Unity3d? 0 Answers
RPC sending Failed 0 Answers
UNET NetIDs for Scene Objects Mismatched Between Client and Server 1 Answer
Racing game using PUN 2 0 Answers
Exiting a UNET lobby causes future ClientRPC calls to be ignored. 1 Answer