question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stale NetworkList event sent to client when its containing object is re-shown.

See original GitHub issue

Description

I have a network object observed by a client containing a network list of structs. On direction by the client a timer is started on the server to remove the entries from the list from the bottom at half a second intervals. At any point the client can choose to deselect the object and the server hides the object from the client and continues to remove entries from the list until all are removed, all is good at this point.

The problem is, the next time the object is shown to the client a pending network list event message is also sent to the client to remove an entry from the network list and because the list is empty an exception is thrown.

Reproduce Steps

  1. Spawn object on client and populate network list
  2. Start timer to remove list entries one at a time
  3. Server hides object from client
  4. All entries in list removed, timer stops
  5. Server shows object to client
  6. NetworkList exception message logged on client

Actual Outcome

“Exception: Shouldn’t be here, index is higher than list length”

Expected Outcome

No network list event message is sent to client.

Environment

  • OS: macOS Big Sur
  • Unity Version: [e.g. 2020.3]
  • Netcode Version: 1.1.0

Additional Context

This happens consistently in my main project, I wasn’t able to reproduce it in a test project but it was only a simple test.

Both list.RemoveAt and list.Remove are producing the same error:

Exception: Shouldn't be here, index is higher than list length Unity.Netcode.NetworkList1[T].ReadDelta (Unity.Netcode.FastBufferReader reader, System.Boolean keepDirtyDelta) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/NetworkVariable/Collections/NetworkList.cs:365) Unity.Netcode.NetworkVariableDeltaMessage.Handle (Unity.Netcode.NetworkContext& context) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/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.1.0/Runtime/Messaging/MessagingSystem.cs:457) 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.1.0/Runtime/Messaging/MessagingSystem.cs:387) UnityEngine.Debug:LogException(Exception) Unity.Netcode.MessagingSystem:HandleMessage(MessageHeader&, FastBufferReader, UInt64, Single, Int32) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/Messaging/MessagingSystem.cs:391) Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue() (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/Messaging/MessagingSystem.cs:407) Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate() (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/Core/NetworkManager.cs:1581) Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/Core/NetworkManager.cs:1513) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/Core/NetworkUpdateLoop.cs:185) Unity.Netcode.<>c:<CreateLoopSystem>b__0_0() (at Library/PackageCache/com.unity.netcode.gameobjects@1.1.0/Runtime/Core/NetworkUpdateLoop.cs:208)

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffreyrainycommented, Dec 1, 2022

Hi,

I managed to repro and explain the issue. Working on a fix. WIP at https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/2328

0reactions
ezoraycommented, Dec 12, 2022

The issue is fixed in my main project. In my test project where it toggles in Update I’m getting this warning:

“Object was shown and hidden from the same client in the same Network frame. As a result, the client will not receive a NetworkSpawn”

What would a Network frame be?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should NetworkList being sync up on client connection?
It works fine if both clients are connected at the same time. However, if a client enters later ( o reconnects), the NetworkList...
Read more >
Class BackendServiceCdnPolicy.Builder (1.7.2) | Java client library
Message containing Cloud CDN configuration for a backend service. ... This is used to clamp the max-age (or Expires) value sent to the...
Read more >
ObjectStore Management
Purpose. ObjectStore Management provides information needed to perform management tasks on ObjectStore Servers and clients. This book.
Read more >
Application Server User's Guide
Wonderware are trademarks of Schneider Electric SE, its subsidiaries, and affiliated ... Using InTouch HMI as the Alarm and Event Client .
Read more >
QRadar Troubleshooting and System Notifications Guide
Event and flow notifications for QRadar appliances ... The DSM Configuration Guide contains a list of product manufacturers and the DSMs that are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found