Skip to content

Conversation

EmandM
Copy link
Collaborator

@EmandM EmandM commented Jul 11, 2025

https://jira.unity3d.com/browse/MTTB-1421
fixes: #3534

Changelog

  • Fixed: When calling CheckDirtyState(true) on a NetworkVariable collection, OnValueChanged now triggers on the authority if the authority has changed the collection and then changed it back to the initial state in the same frame. This matches the behaviour of non-collection NetworkVariables.

Testing and Documentation

  • Includes unit tests.
  • Includes integration tests.

Backport

This is a backport of #3539

@EmandM EmandM requested a review from a team as a code owner July 11, 2025 20:18
EmandM added a commit that referenced this pull request Jul 11, 2025
…ction changes back to the previous value (#3539)

https://jira.unity3d.com/browse/MTTB-1421
fixes: #3534 

## Changelog

- Fixed: When calling `CheckDirtyState(true)` on a `NetworkVariable`
collection, `OnValueChanged` now triggers on the authority if the
authority has changed the collection and then changed it back to the
initial state in the same frame. This matches the behaviour of
non-collection NetworkVariables.

## Testing and Documentation

- Includes unit tests.
- Includes integration tests.

## Backport

Backported by #3544
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did a 1:1 review on this for v2.x and it still looks good to me for v1.x.
👍

@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) July 28, 2025 15:54
@EmandM EmandM disabled auto-merge July 28, 2025 18:25
@EmandM EmandM enabled auto-merge (squash) July 28, 2025 18:26
@EmandM EmandM merged commit a93c4d8 into develop Jul 28, 2025
26 checks passed
@EmandM EmandM deleted the fix/1.x/collection-authority-onvaluechanged branch July 28, 2025 19:54
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.

NetworkVariable<List<T>>.CheckDirtyState(true) doesn't trigger OnValueChanged when changed back in the same frame

2 participants