Search Unity

Bug NetworkList is not synchronising across to clients

Discussion in 'Netcode for GameObjects' started by AaronKB, Jun 20, 2022.

  1. AaronKB

    AaronKB

    Joined:
    Aug 16, 2019
    Posts:
    27
    Hi.
    I have a couple a few components set up, trying to sync a NetworkList but it's not synchronising to standalone clients - I have other NetworkLists the work fine but not this one.

    I have a server component, client component and a shared state component.

    When the server component OnNetworkSpawns, I add values to the list.

    I don't get any change messages on the standalone client (Although the host client gets them)
    I don't get any initial values on the standalone client, the list remains empty.

    Also, when, on the host I change one of the items in the list and it attempts to serilialse it I am getting an exception on the standalone client (Not the host). As part of my game, I will change one of the values in the list. When I do, the exception below occurs and I am wondering if it's confused as to what length was serialised compared to the actual list length (It's empty remember because it didn't sync).

    Are there any special processes I need to take for NetworkList that I'm un aware of - such ascreation order etc? It looks like I'm using it just like I do for the other lists I have so I am not sure what's up.

    Thanks

    Exception: Shouldn't be here, index is higher than list length
    Unity.Netcode.NetworkList`1[T].ReadDelta (Unity.Netcode.FastBufferReader reader, System.Boolean keepDirtyDelta) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/NetworkVariable/Collections/NetworkList.cs:264)
    Unity.Netcode.NetworkVariableDeltaMessage.Handle (Unity.Netcode.NetworkContext& context) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Messaging/Messages/NetworkVariableDeltaMessage.cs:200)
    Unity.Netcode.MessagingSystem.ReceiveMessage[T] (Unity.Netcode.FastBufferReader reader, Unity.Netcode.NetworkContext& context, Unity.Netcode.MessagingSystem system) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Messaging/MessagingSystem.cs:338)
    Unity.Netcode.MessagingSystem.HandleMessage (Unity.Netcode.MessageHeader& header, Unity.Netcode.FastBufferReader reader, System.UInt64 senderId, System.Single timestamp, System.Int32 serializedHeaderSize) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Messaging/MessagingSystem.cs:269)
    UnityEngine.Debug:LogException(Exception)
    Unity.Netcode.MessagingSystem:HandleMessage(MessageHeader&, FastBufferReader, UInt64, Single, Int32) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Messaging/MessagingSystem.cs:273)
    Unity.Netcode.MessagingSystem:processIncomingMessageQueue() (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Messaging/MessagingSystem.cs:288)
    Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate() (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Core/NetworkManager.cs:1348)
    Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Core/NetworkManager.cs:1319)
    Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Core/NetworkUpdateLoop.cs:149)
    Unity.Netcode.<>c:<CreateLoopSystem>b__0_0() (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Runtime/Core/NetworkUpdateLoop.cs:172)
     
    Last edited: Jun 20, 2022
    modaka-cov likes this.
  2. Boolable

    Boolable

    Joined:
    Jun 28, 2015
    Posts:
    20
    Hi,

    I'm facing the same problem. Did you find a solution?
     
  3. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    666
    I'm not seeing the error but I've updated from pre7 to pre10 and now not all network lists are being populated on the client.
     
  4. unity_jeffr

    unity_jeffr

    Unity Technologies

    Joined:
    May 13, 2021
    Posts:
    2
    Hi,

    We're aware of some issues with NetworkList. A first fix that is making its way towards a release has been pushed to a development branch. Would you be in a position where you can test an unreleased branch and let us know if it helps any?

    The branch is fix/in-scene-networklist
    The commit you are after is 19dbda7f80df7c7a2c1b231c61143492a7f452da
    You can see it in Github: https://github.com/Unity-Technologi...mmit/19dbda7f80df7c7a2c1b231c61143492a7f452da

    Please let us know. The plan is for us to bullet-proof our testing and once we think we've got all issues around NetworkList, include it in next release.

    Thanks!
    J.
     
  5. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    666
    As per my Github comment this fix solves the problem for me.
     
  6. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    I also have this problem
     
  7. TruckerJoe

    TruckerJoe

    Joined:
    Feb 25, 2019
    Posts:
    39
    I am using Netcode for GameObjects V1.5.2 and get the error, isn´t this fixed til now?
    Here is the full error:

    Exception: Shouldn't be here, index is higher than list length
    at Unity.Netcode.NetworkList`1[T].ReadDelta (Unity.Netcode.FastBufferReader reader, System.Boolean keepDirtyDelta) [0x00563] in .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\NetworkVariable\Collections\NetworkList.cs:365
    at Unity.Netcode.NetworkVariableDeltaMessage.Handle (Unity.Netcode.NetworkContext& context) [0x002b5] in .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Messaging\Messages\NetworkVariableDeltaMessage.cs:200
    at Unity.Netcode.NetworkMessageManager.ReceiveMessage[T] (Unity.Netcode.FastBufferReader reader, Unity.Netcode.NetworkContext& context, Unity.Netcode.NetworkMessageManager manager) [0x000d9] in .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Messaging\NetworkMessageManager.cs:564
    at (wrapper delegate-invoke) <Module>.invoke_void_FastBufferReader_NetworkContext&_NetworkMessageManager(Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager)
    at Unity.Netcode.NetworkMessageManager.HandleMessage (Unity.Netcode.NetworkMessageHeader& header, Unity.Netcode.FastBufferReader reader, System.UInt64 senderId, System.Single timestamp, System.Int32 serializedHeaderSize) [0x00128] in .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Messaging\NetworkMessageManager.cs:432
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    Unity.Netcode.NetworkMessageManager:HandleMessage(NetworkMessageHeader&, FastBufferReader, UInt64, Single, Int32) (at .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Messaging\NetworkMessageManager.cs:436)
    Unity.Netcode.NetworkMessageManager:processIncomingMessageQueue() (at .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Messaging\NetworkMessageManager.cs:458)
    Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Core\NetworkManager.cs:42)
    Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Core\NetworkUpdateLoop.cs:185)
    Unity.Netcode.<>c:<CreateLoopSystem>b__0_0() (at .\Library\PackageCache\com.unity.netcode.gameobjects@1.5.2\Runtime\Core\NetworkUpdateLoop.cs:208)