Search Unity

UNet Client Disconnect Error: CRC Mismatch after Unity Editor crash

Discussion in 'UNet' started by Palimon, Jul 2, 2015.

  1. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    Hey, I get the error "UNet Client Disconnect Error: CRC Mismatch" when I try to use the NetworkManagerHUD to launch a client. My best guess is it's a result of Unity crashing. I was happily testing my multiplayer and the Unity Editor went non-responsive for 5min, after which I had to force kill the process. I noticed some of my scene work was lost, so I did my best to add it back in. Now, everything seems to work as before, including launching through the HUD as a host. When I try to build, run, host, then play in Unity and connect as a localhost client as before I now get the above error. I get the same result using the provided NetworkManager. If I change the Network Port from 7777 to 7778, I do not get the error and can join as a client but a player is never spawned in the scene - the host does spawn one.

    Did Unity somehow keep that old port tied up when it crashed? I rebooted my machine and nothing changed.
     
    nventimiglia likes this.
  2. WillTM

    WillTM

    Joined:
    Nov 11, 2013
    Posts:
    4
    I seen CRC type errors when the scene open in the unity editor was not the same as the scene in the build I was connecting to.. They were duplicate scenes exact in every way except 'Level2' in editor. and 'Level1' was the level included in the build settings.. thought it is worth a mention at least :)
     
  3. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    Ah, I think that was it! I did get passed the error randomly late last night, but I'm almost certain that was it. I copied my scene and at one point set one as offline and one as online in NetworkManager, and I bet I got that messed up in my build settings :). Thanks!
     
  4. LeopardX

    LeopardX

    Joined:
    May 31, 2015
    Posts:
    64
    Im getting this error too, however I have two levels which both is included in the build menu, i have not been able to fix it.. the editor and build should have exacly the same scenes..

    I might add i recently updated to 5.1.3 f1.. which may be to blame..
     
  5. LeopardX

    LeopardX

    Joined:
    May 31, 2015
    Posts:
    64
    Found out what it was, its max number of connections in the editor if you set it to 50 it generates this error, so i set it to the defualt 4 and it works..
     
  6. Deleted User

    Deleted User

    Guest

    It can also happen when the client and server dont have matching network manager settings (like ack time or fragment sizes)
     
  7. LeopardX

    LeopardX

    Joined:
    May 31, 2015
    Posts:
    64
    Just to add, if anyone gets this after they change the max number of connections on networkmanger under the editor, set it back to defult, and then set it at runtime insted and works fine..

    Working example:

    using UnityEngine;
    using System.Collections;
    using UnityEngine.Networking;

    public class StartServer : MonoBehaviour {

    string HostName = "127.0.0.1";

    public void _StartupHost()
    {
    NetworkManager.singleton.networkPort = 7777;
    NetworkManager.singleton.maxConnections = 50;
    NetworkManager.singleton.StartHost ();
    }

    public void _JoinWorld()
    {
    NetworkManager.singleton.networkAddress = HostName;
    NetworkManager.singleton.networkPort = 7777;
    NetworkManager.singleton.StartClient ();
    }
    }