Skip to content

fix: networkvariable not synchronizing changes made during spawn or post-spawn. - #3878

Merged
NoelStephensUnity merged 13 commits into
develop-2.0.0from
fix/networkvariable-onspawned-missing
Feb 11, 2026
Merged

fix: networkvariable not synchronizing changes made during spawn or post-spawn.#3878
NoelStephensUnity merged 13 commits into
develop-2.0.0from
fix/networkvariable-onspawned-missing

Conversation

@NoelStephensUnity

@NoelStephensUnityNoelStephensUnity commented Feb 10, 2026

Copy link
Copy Markdown
Member

This is a regression bug introduced in #3664

Purpose of this PR

This PR fixes the issue where NetworkVariable was not properly synchronizing to changes made by the spawn and write authority during OnNetworkSpawn and OnNetworkPostSpawn.

Jira ticket

UUM-134322
fix: #3876

Changelog

  • Fixed: Issue where NetworkVariable was not properly synchronizing to changes made by the spawn and write authority during OnNetworkSpawn and OnNetworkPostSpawn.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done
    • Used local project and test project.

Automated tests:

  • Covered by new automated tests
    • NetworkVariableGeneralTests

Does 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

This does not require a backport.

Fixing the issue with the missing `OnSpawned` override within `NetworkVariable`.
Adding a general test for scenarios like this one.
@NoelStephensUnity
NoelStephensUnity requested a review from a team as a code ownerFebruary 10, 2026 22:06
@NoelStephensUnityNoelStephensUnity added the regression The issue is a regression (something that was working in previous version) label Feb 10, 2026
Adding changelog entry.
Adding comments for clarity of what `OnSpawned` and the call to `PostNetworkVariableWrite` is for.
Removing trailing whitespaces.
Just apply the changes to the NetworkVariable instance and not all NetworkVariables of the NetworkBehaviour.
correcting the comment.
Very similar to NetworkList (we might collapse the OnSpawned logic into NetworkVariableBase.
OwnerModifiedTests was not properly spawning from the non-session owner client (it was spawning with ownership on the session owner side).
NetworkVariableCollectionTests is showing an issue with changes for only the host instance and only within the TestDictionaryCollections (has to do with trying to add and then reverting vs the tracked changes).
Narrowed down the issue to the changes tracked (i.e. added, removed, changed, unchanged) not matching when running a host but when comparing the actual dictionaries that all passes...
Removing developer logging.
@michalChrobot

Copy link
Copy Markdown
Member

Are you sure you linked the correct PR as the regression root? (you linked CoreCLR update)

@NoelStephensUnity

Copy link
Copy Markdown
MemberAuthor

Are you sure you linked the correct PR as the regression root? (you linked CoreCLR update)

Yeah it was supposed to be #3664...

Fixed the issue in the `TestDictionaryCollections` test where clients that did not have the initial added target changes for server changes when running a host. Now, upon clients spawning players locally on the clients, the server write dictionary that is already populated by the host will have the added target changes injected during spawn to assure the changes match. (This is only for this specific test when running the host `TestFixture` pass.
@NoelStephensUnity
NoelStephensUnity enabled auto-merge (squash) February 11, 2026 17:40
removing unused debug related script.
Based on peer review, folding the same logic for spawn authority resetting dirty once spawned to assure no duplicate changes are sent.
@NoelStephensUnity
NoelStephensUnity merged commit 454d04f into develop-2.0.0Feb 11, 2026
23 of 24 checks passed
@NoelStephensUnity
NoelStephensUnity deleted the fix/networkvariable-onspawned-missing branch February 11, 2026 21:37
NoelStephensUnity added a commit that referenced this pull request Feb 11, 2026
…ost-spawn. (#3878)
* fix
Fixing the issue with the missing `OnSpawned` override within `NetworkVariable`.
* test
Adding a general test for scenarios like this one.
* update
Adding changelog entry.
* style
Adding comments for clarity of what `OnSpawned` and the call to `PostNetworkVariableWrite` is for.
Removing trailing whitespaces.
* refactor
Just apply the changes to the NetworkVariable instance and not all NetworkVariables of the NetworkBehaviour.
* style
correcting the comment.
* fix
Very similar to NetworkList (we might collapse the OnSpawned logic into NetworkVariableBase.
* test-fix
OwnerModifiedTests was not properly spawning from the non-session owner client (it was spawning with ownership on the session owner side).
NetworkVariableCollectionTests is showing an issue with changes for only the host instance and only within the TestDictionaryCollections (has to do with trying to add and then reverting vs the tracked changes).
* test
Narrowed down the issue to the changes tracked (i.e. added, removed, changed, unchanged) not matching when running a host but when comparing the actual dictionaries that all passes...
* test
Removing developer logging.
* test - fix
Fixed the issue in the `TestDictionaryCollections` test where clients that did not have the initial added target changes for server changes when running a host. Now, upon clients spawning players locally on the clients, the server write dictionary that is already populated by the host will have the added target changes injected during spawn to assure the changes match. (This is only for this specific test when running the host `TestFixture` pass.
* style
removing unused debug related script.
* update
Based on peer review, folding the same logic for spawn authority resetting dirty once spawned to assure no duplicate changes are sent.
NoelStephensUnity added a commit that referenced this pull request Feb 11, 2026
…ost-spawn. (#3878)
* fix
Fixing the issue with the missing `OnSpawned` override within `NetworkVariable`.
* test
Adding a general test for scenarios like this one.
* update
Adding changelog entry.
* style
Adding comments for clarity of what `OnSpawned` and the call to `PostNetworkVariableWrite` is for.
Removing trailing whitespaces.
* refactor
Just apply the changes to the NetworkVariable instance and not all NetworkVariables of the NetworkBehaviour.
* style
correcting the comment.
* fix
Very similar to NetworkList (we might collapse the OnSpawned logic into NetworkVariableBase.
* test-fix
OwnerModifiedTests was not properly spawning from the non-session owner client (it was spawning with ownership on the session owner side).
NetworkVariableCollectionTests is showing an issue with changes for only the host instance and only within the TestDictionaryCollections (has to do with trying to add and then reverting vs the tracked changes).
* test
Narrowed down the issue to the changes tracked (i.e. added, removed, changed, unchanged) not matching when running a host but when comparing the actual dictionaries that all passes...
* test
Removing developer logging.
* test - fix
Fixed the issue in the `TestDictionaryCollections` test where clients that did not have the initial added target changes for server changes when running a host. Now, upon clients spawning players locally on the clients, the server write dictionary that is already populated by the host will have the added target changes injected during spawn to assure the changes match. (This is only for this specific test when running the host `TestFixture` pass.
* style
removing unused debug related script.
* update
Based on peer review, folding the same logic for spawn authority resetting dirty once spawned to assure no duplicate changes are sent.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regressionThe issue is a regression (something that was working in previous version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NetworkVariable modified in OnNetworkSpawn (Server) sends default value in initial CreateObjectMessage

3 participants

@NoelStephensUnity@michalChrobot@EmandM