Skip to content

Commit f8944ff

Browse files
Fix NetworkDictionary not working (#186)
NetworkDictionary was not marking the underlying NetworkBehaviour as dirty, and hence its changes were never processed.
1 parent 9524067 commit f8944ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

com.community.netcode.extensions/Runtime/NetworkDictionary/NetworkDictionary.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,15 @@ public TValue this[TKey key]
474474
private void HandleAddDictionaryEvent(NetworkDictionaryEvent<TKey, TValue> dictionaryEvent)
475475
{
476476
m_DirtyEvents.Add(dictionaryEvent);
477+
MarkNetworkObjectDirty();
477478
OnDictionaryChanged?.Invoke(dictionaryEvent);
478479
}
479480

481+
internal void MarkNetworkObjectDirty()
482+
{
483+
m_NetworkBehaviour.NetworkManager.MarkNetworkObjectDirty(m_NetworkBehaviour.NetworkObject);
484+
}
485+
480486
public override void Dispose()
481487
{
482488
m_Keys.Dispose();
@@ -547,4 +553,4 @@ public enum EventType : byte
547553
}
548554
}
549555

550-
#endif
556+
#endif

0 commit comments

Comments
 (0)