NetworkVariable which have NetworkVariableWritePermission.Owner occurred infinity calling WriteDelta() from server.
Description
NetworkBehaviourUpdater.NetworkBehaviourUpdate() update every network variables for every connected clients. Inside of NetworkBehaviour.VariableUpdate() calls NetworkBehaviour.PreNetworkVariableWrite() and it clear list variable NetworkVariableIndexesToReset. But last client(in networkManager.ConnectedClientsList)'s variable is changed which has NetworkVariableWritePermission.Owner, at the last of update loop, it clears NetworkVariableIndexesToReset and ignore write because this client has write permission of that variable. So at the end of update loop NetworkVariableIndexesToReset is cleared. And called NetworkBehaviour.PostNetworkVariableWrite => do nothing. Server side : this NetworkVariable remains dirtyflag is true. and calling WriteDelta() at every Update.
Reproduce Steps
- Host client A(client id: 0), Clients B(client id:1), C(client id:2) and they have NetworkVariable
with NetworkVariableWritePermission.Owner. - Update C's variable.
- Server start calling WriteDelta() of C's NetworkVariable every tick.
- B received ReadDelta of C's NetworkVariable every tick.
Actual Outcome
Expected Outcome
Screenshots
Environment
- OS: Windows 11
- Unity Version: 2021.3.3f1
- Netcode Version: 1.0.0
- Netcode Commit: -
Additional Context
Backlog https://jira.unity3d.com/browse/MTT-4386
Thank you for the submission, this is a good write-up. Working on a fix.
A fix as been merge to the develop branch, for the next release. Thanks for the report!
Thank you! I'll wait next release with pleasure.