Skip to content

Conversation

@NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Aug 10, 2024

When using collections with NetworkVariable, it would only detect a completely new assignment of a collection but would not detect a change to an already assigned collection (add, remove, insert, clear) nor was there a convenient way to check if a collection or the values of its items/elements were dirty.

MTTB-305

fix: #2993

Changelog

  • Added NetworkVariable.CheckDirtyState that is to be used in tandem with collections in order to detect whether the collection or an item within the collection has changed.
  • Fixed issue using collections within NetworkVariable where the collection would not detect changes to items or nested items.
  • Fixed issue where List, Dictionary, and HashSet collections would not uniquely duplicate nested collections.
  • Changed permissions exception thrown in NetworkList to exiting early with a logged error that is now a unified permissions message within NetworkVariableBase.
  • Changed permissions exception thrown in NetworkVariable.Value to exiting early with a logged error that is now a unified permissions message within NetworkVariableBase.

Testing and Documentation

  • Includes integration tests in NetworkVariableCollectionsTests.
  • Requires documentation updates.

First pass in fixing the issues with managed collections.
Adjustments to handle the removal of throwing exceptions.
removing whitespace
Detecting a delta by direct assignment of an already assigned list will not work with NetworkVariable and would require a pretty hefty rework on how we handle detecting a delta in a collection without impacting non-collection types.
we don't need to duplicate anymore since we are not detecting whether any items in a collection are different when directly assigning the same collection.
cleaning up some of the NetworkVariable associated tests so they are contained in a subfolder and so each test is contained in its own CS file.
Mark that we have a previous value for disposing when destroyed.
This fixes an issue with duplicating nested lists, hashsets, and dictionaries.
This is the first set of tests for Lists, including nested, that test using base types and INetworkSerializable.
Still have HashSet and Dictionary to cover.
@NoelStephensUnity NoelStephensUnity changed the title fix: managed collections not detecting deltas fix: collections not detecting deltas Aug 12, 2024
Added Dictionary and HashSet to the tests.
Removing whitespaces
adding changelog entries
setting the right PR associated with these updates
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review August 12, 2024 22:26
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner August 12, 2024 22:26
@NoelStephensUnity NoelStephensUnity merged commit 133c125 into develop-2.0.0 Aug 13, 2024
@NoelStephensUnity NoelStephensUnity deleted the fix/managed-collections-not-detecting-deltas branch August 13, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants