Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Weird network problem

Discussion in 'Multiplayer' started by 3B00DG4MER, Aug 12, 2016.

  1. 3B00DG4MER

    3B00DG4MER

    Joined:
    Jun 24, 2015
    Posts:
    64
    Hi guys, lately i've been trying to fix a problem made me rage alot :p
    I tried to debug some lines, but i didn't even know why is the error happening
    Everytime i host a game
    Error line :

    IndexOutOfRangeException: NetworkReader:ReadBytes out of range: (321) NetBuf sz:96 pos:35
    UnityEngine.Networking.NetBuffer.ReadBytes (System.Byte[] buffer, UInt32 count) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:45)
    UnityEngine.Networking.NetworkReader.ReadBytes (Int32 count) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkReader.cs:339)
    UnityEngine.Networking.NetworkReader.ReadBytesAndSize () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkReader.cs:349)
    UnityEngine.Networking.NetworkSystem.ObjectSpawnMessage.Deserialize (UnityEngine.Networking.NetworkReader reader) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/Messages.cs:351)
    UnityEngine.Networking.NetworkMessage.ReadMessage[ObjectSpawnMessage] (UnityEngine.Networking.NetworkSystem.ObjectSpawnMessage msg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/UNetwork.cs:168)
    UnityEngine.Networking.ClientScene.OnLocalClientObjectSpawn (UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:679)
    UnityEngine.Networking.NetworkConnection.InvokeHandler (UnityEngine.Networking.NetworkMessage netMsg) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:213)
    UnityEngine.Networking.LocalClient.ProcessInternalMessages () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/LocalClient.cs:142)
    UnityEngine.Networking.LocalClient.Update () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/LocalClient.cs:69)
    UnityEngine.Networking.NetworkClient.UpdateClients () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:949)
    UnityEngine.Networking.NetworkIdentity.UNetStaticUpdate () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:1061)



    Help me plzz !!!!
     
  2. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    If you're sure that you are sending the correct types in the correct order, the same error can be caused by not using NetworkWriter.FinishMessage() when writing the message.
     
  3. 3B00DG4MER

    3B00DG4MER

    Joined:
    Jun 24, 2015
    Posts:
    64
    I'm not using NetworkWriter at all, Could it be from the NetworkAnimator component or the NetworkIdentity ?
     
  4. 3B00DG4MER

    3B00DG4MER

    Joined:
    Jun 24, 2015
    Posts:
    64
    I just found out that the problem was from the current player prefab
    i tried creating another one everything was okay,
    But i'm trying to find out the problem ...