CRC warning and InvalidOperationException

In my current project I’m getting a CRC warning and an InvalidOperationException. I’m also getting a Debug.Log from the CRC. The errors appear even with a fresh build with manually deleted files from the previous build.

It only appears when I try to connect from the editor to a standalone build acting as a host.

Here they are in order:

Network configuration mismatch detected. The number of networked scripts on the client does not match the number of networked scripts on the server. This could be caused by lazy loading of scripts on the client. This warning can be disabled by the checkbox in NetworkManager Script CRC Check.
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
CRC Local Dump PlayerHandler : 0
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
InvalidOperationException: out of sync
System.Collections.Generic.Dictionary`2+Enumerator[System.String,System.Int32].VerifyState () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:912)
System.Collections.Generic.Dictionary`2+Enumerator[System.String,System.Int32].MoveNext () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:835)
System.Collections.Generic.Dictionary`2+KeyCollection+Enumerator[System.String,System.Int32].MoveNext () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:1028)
UnityEngine.Networking.NetworkCRC.Dump (UnityEngine.Networking.NetworkSystem.CRCMessageEntry[] remoteScripts) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkCRC.cs:106)
UnityEngine.Networking.NetworkCRC.ValidateInternal (UnityEngine.Networking.NetworkSystem.CRCMessageEntry[] remoteScripts, Int32 numChannels) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkCRC.cs:75)
UnityEngine.Networking.NetworkCRC.Validate (UnityEngine.Networking.NetworkSystem.CRCMessageEntry[] scripts, Int32 numChannels) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkCRC.cs:66)
UnityEngine.Networking.NetworkClient.OnCRC (UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:801)
UnityEngine.Networking.NetworkConnection.HandleReader (UnityEngine.Networking.NetworkReader reader, Int32 receivedSize, Int32 channelId) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:430)
UnityEngine.Networking.NetworkConnection.HandleBytes (System.Byte[] buffer, Int32 receivedSize, Int32 channelId) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:386)
UnityEngine.Networking.NetworkConnection.TransportRecieve (System.Byte[] bytes, Int32 numBytes, Int32 channelId) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:536)
UnityEngine.Networking.NetworkClient.Update () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:648)
UnityEngine.Networking.NetworkClient.UpdateClients () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:861)
UnityEngine.Networking.NetworkIdentity.UNetStaticUpdate () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:1059)

Bump, this is stopping me from working on my project, and I haven’t found a fix yet.

So disabling CRC check does allow me to connect and go into the game. However, I’m worried since it’s telling me that the amount of scripts doesn’t match in the editor vs the standalone, and I’d really like to know the cause of this.

So this is very weird, but setting the loglevel to something else removes this problem? I’ve no idea why, but now there’s no CRC warning or sync errors.

I’ve also experiencing this issue under the same conditions (unity client connecting to ext. host).

I think it would be the best if you submit an official bug report with a small test project attached so that the unity guys can reproduce the issue. Bug reports seem to be the quickest way to get unity staff attention and a potential fix.

However, I am not really sure if this behavior is actually a bug or by design (e.g. because the CRC always throws errors because unity instance and ext. build are always different in some ways).

Nevertheless, at least, the official documentation should provide clear information on how to deal with this. Unfortunately, this is not the case at the moment.

I think it’s a bug, and I have no idea how to recreate it. It just randomly appeared, so it’s hard to report a bug on it. I decided to just skip the NetworkManager and go over to NetworkServer and Client instead, seems to be better for my use anyways.

I suddenly started having the same problem, out of the blue.

Yesterday the project ran just fine, today I get these random errors.
Still trying to pinpoint what may have triggered it, but however it goes, it makes no sense: it claims the server and client mismatch, when they shouldn’t.

Server instance: Unity counts every single class that extends NetworkBehaviour, doesn’t matter if it’s not present in the current or in any scene of your project.

Client instance: Only the present ones in the scene are begin counted.

Hi guys, so I was also having this error and found the solution when I started actually counting the number of networking scripts that were on the server as well as on the client, the thing that I found was that one of my networking objects with a network identity was checked to server only, which caused the difference in the count since the object was disabled on the client, thus the conflict, I unchecked the box, saved and rebuilt, and the error was gone. Hope this helps :slight_smile:

1 Like

This whole topic makes me think:
What is necessary to keep a NetworkBehaviour CRC compliant?

Does it mean there musn’t be ANY difference? No compiler directive at all and such. completely identical?