com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

NetworkVariable which have NetworkVariableWritePermission.Owner occurred infinity calling WriteDelta() from server.

Open Finn-NHNEdu opened this issue 3 years ago • 1 comments

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

  1. Host client A(client id: 0), Clients B(client id:1), C(client id:2) and they have NetworkVariable with NetworkVariableWritePermission.Owner.
  2. Update C's variable.
  3. Server start calling WriteDelta() of C's NetworkVariable every tick.
  4. 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

Finn-NHNEdu avatar Aug 08 '22 01:08 Finn-NHNEdu

Backlog https://jira.unity3d.com/browse/MTT-4386

ashwinimurt avatar Aug 12 '22 00:08 ashwinimurt

Thank you for the submission, this is a good write-up. Working on a fix.

jeffreyrainy avatar Aug 16 '22 21:08 jeffreyrainy

A fix as been merge to the develop branch, for the next release. Thanks for the report!

jeffreyrainy avatar Aug 18 '22 01:08 jeffreyrainy

Thank you! I'll wait next release with pleasure.

Finn-NHNEdu avatar Aug 19 '22 06:08 Finn-NHNEdu