- Home /
Multiplayer Game Disconnects
Sorry about this long post, I thought I would explain everything as best I could.
I am making a basic multiplayer game mostly just to learn the new multiplayer tools in Unity 5. I have 2 scenes. The first scene has just an empty game object with the Network Manager and Network Manager HUD attached to it. There is a second scene where the player spawns in when they get connected to the network. This error only occurs when the Network Manager has Network Simulation checked. I have it set to 75 MS so it should only hit about 150 ping or so. Here is a picture of my Network Manager's settings:
The player is the built in Rigidbody FPS Controller. He has a Network Identify attached with Local Player Authority attached to him. He also has a script I made myself that is very basic. It simply turns on his Rigidbody First Person Controller script and turns on his camera if it is the local player. Here is the script:
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using UnityEngine.UI;
public class multiplayerActivate : NetworkBehaviour {
[SerializeField]GameObject playerCam;
private NetworkClient nClient;
private int latency;
private Text latencyText;
// Use this for initialization
void Start ()
{
nClient = GameObject.Find("networkManager").GetComponent<NetworkManager>().client;
latencyText = GameObject.Find("Ping").GetComponent<Text>();
if (isLocalPlayer)
{
playerCam.SetActive(true);
GetComponent<UnityStandardAssets.Characters.FirstPerson.RigidbodyFirstPersonController>().enabled = true;
}
}
// Update is called once per frame
void Update ()
{
ShowLatency();
}
void ShowLatency()
{
if (isLocalPlayer)
{
latency = nClient.GetRTT();
latencyText.text = latency.ToString();
}
}
}
When I build and run I get no errors. I then use the stand alone client to be the host while the editor is the client. Both players spawn in but the editor player's lighting is completely different. The light color is much darker. After about 20 seconds of running around as the host, the client (the editor) disconnects and I get the following 2 errors:
aissp: time {1839778} lastRecTime {1837343} DisTme {2000}, rtt {69}
UNet Client Disconnect Error: Timeout
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
And the following warning error:
Multiple NetworkManagers detected in the scene. Only one NetworkManager can exist at a time. The duplicate NetworkManager will not be used.
UnityEngine.Networking.NetworkManager:Awake()
There is not more than one NetworkManager. I also get this warning even if I just play from the editor without the stand alone client.
Also, the disconnect doesn't seem to happen if I set the network simulation ping below 50 or if I turn it off entirely. It runs just fine then but I still get the more than one NetworkManager error no matter what. I also added a ping script that basically just shows the ping of the client, and it never gets close to the 500 ping timeout setting. It only hits about 150-180 max.
That's all the info I can think of. Do you guys have any ideas?
Answer by ManjiDM · Nov 09, 2015 at 11:13 AM
@drex150 I also have the same problem regarding the network manager and don't know the answer to that problem. For the lighting problem you should select the "levelTest" scene and then in "Window->Lighting->Scene" there's an "Auto" checkbox in the bottom that in your case is probably checked. You should uncheck it and then press the "Build" button to the right. After some processing it should bake lightmaps and solve your problem. Hopefully it will work as it did for me :)