I have a multiplayer game and when I launch the host, I can select a character and he spawns with no problem. But when I try and join the game on another (local) client, the character gets created in the scene at (0,0,0) but then I get this fatal error every time:
IndexOutOfRangeException: NetworkReader:ReadBytes out of range: (25908) NetBuf sz:280 pos:204
UnityEngine.Networking.NetBuffer.ReadBytes (System.Byte[] buffer, UInt32 count) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:45)
UnityEngine.Networking.NetworkReader.ReadString () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkReader.cs:302)
SyncListItem.DeserializeItem (UnityEngine.Networking.NetworkReader reader)
Unity.GeneratedNetworkCode._ReadStructSyncListItem_None (UnityEngine.Networking.NetworkReader reader, .SyncListItem instance)
Player.OnDeserialize (UnityEngine.Networking.NetworkReader reader, Boolean initialState)
UnityEngine.Networking.NetworkIdentity.OnUpdateVars (UnityEngine.Networking.NetworkReader reader, Boolean initialState) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:753)
UnityEngine.Networking.ClientScene.ApplySpawnPayload (UnityEngine.Networking.NetworkIdentity uv, Vector3 position, System.Byte[] payload, NetworkInstanceId netId, UnityEngine.GameObject newGameObject) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:478)
UnityEngine.Networking.ClientScene.OnObjectSpawn (UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:533)
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)
I’ve been trying to track down exactly where this happens but to no avail.
Note: I am using a package from the asset store that extends NetworkManager.cs
Edit:
I’m also getting this error when I run the game. I’m not sure if it has anything to do with it.
NetworkManager detected a script reload in the editor. This has caused the network to be shut down.
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()