- Home /
Mix unity Network Manager with own network script
Hello,
I have a network multiplayer game with blue and red players. When there is a blue player already then the next player should be a red player that joins. It should come out to equally 4v4 in the end. The unity network manager already takes care of spawning my blue player since I put in Network Manager -> Spawn Info -> Player Prefab. How would I achieve it, that the next player who joins is team red?
Thanks in advance.
The way I'd do it is have both blue and red be the same prefab, you just set some setting on the prefab to set the $$anonymous$$m. As player objects are added to the scene the server keeps track of what $$anonymous$$m each is on and calls whatever method or sets whatever variable you choose to deter$$anonymous$$e $$anonymous$$m membership on the player object, alternating $$anonymous$$ms.
Answer by LucyLuna · Apr 14, 2017 at 02:13 AM
You can also override the OnSeverAddPlayer() function in NetworkManager . :)
That would be great! Can you help me achieve that? I am very new to unity and I have no idea where to create the correct network script that overrides the function and how I connect it to the correct GameObject etc.. A lot of details that I need to wrap my around first.