Skip to content

fix: OnValueChanged not being triggered on collections when the collection changes back to the previous value #3539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2025

Conversation

EmandM
Copy link
Collaborator

@EmandM EmandM commented Jul 9, 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

Backported by #3544

@EmandM EmandM requested a review from a team as a code owner July 9, 2025 20:21
@EmandM EmandM added the port:1.x-needed This issue needs to be ported to 1.X branch label Jul 9, 2025
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.

Nice catch and fix!

@sentinel-u3d sentinel-u3d bot requested a review from NoelStephensUnity July 10, 2025 19:57
// lowest risk approach to resolving the issue where a client with no write permissions could make changes to a collection locally
// which can cause a myriad of issues.
private protected T m_InternalOriginalValue;
/// <summary>
Copy link
Collaborator

Choose a reason for hiding this comment

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

😻

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.

Very nice!
:godmode:

@EmandM EmandM added port:1.x-completed This issue was ported to 1.X branch and removed port:1.x-needed This issue needs to be ported to 1.X branch labels Jul 11, 2025
@EmandM EmandM merged commit dc58e42 into develop-2.0.0 Jul 11, 2025
37 checks passed
@EmandM EmandM deleted the fix/collection-authority-onvaluechanged branch July 11, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
port:1.x-completed This issue was ported to 1.X branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants