fix: NetworkVariable clearing dirty flags after OnNetworkSpawn#3779
Merged
NoelStephensUnity merged 9 commits intodevelop-2.0.0from Nov 14, 2025
Conversation
…flags-after-onnetworkspawn
This migrates the NetworkList specific script from NetworkBehaviour.InternalOnNetworkSpawn into NetworkList itself. It also provides (currently) two internal virtual methods, NetworkVariableBase.OnSpawned and NetworkVariableBase.OnPreDespawn, to provide a means for NetworkList to handle cleaning its dirty state up after the instance with write permissions has finished running through the spawn stages (pre-spawn, spawning, post-spawn, gets invoked).
Fixing the race condition test instability when running OwnershipPermissionsTests against CMB service until the order in which a message is received will reflect the order in which it is sent relative to messages received prior to and after the given message.
noellie-velez
approved these changes
Nov 14, 2025
Collaborator
noellie-velez
left a comment
There was a problem hiding this comment.
Looks good to me! 🚀
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
This includes a fix for the forum reported issue-1693204 where spawning with ownership in a distributed authority topology where the owner is not the spawn authority, and the network prefab being spawned has NetworkBehaviour script that sets a NetworkVariable during OnNetworkSpawn, then the changes made would not be synchronized.
Jira ticket
MTTB-1735
Changelog
Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAbove replication project used for testing
Verifying the fix:

Note:
The player colors are correct (green highlighted) and the log output shows that a follow up
NetworkVariableDeltaMessageis sent when the owning client updates theCurrentPlayerColornetwork variable duringOnNetworkSpawn(green highlight bottom right of the above screenshot).Replicating the issue:
Note the following issues:

NetworkVariableDeltaMessageis sent when the owning client updates theCurrentPlayerColornetwork variable duringOnNetworkSpawn.Automated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?If any boxes above are checked the QA team will be automatically added as a PR reviewer.
Backports
No back port is required.