Skip to content

Commit a052416

Browse files
refactor
Just apply the changes to the NetworkVariable instance and not all NetworkVariables of the NetworkBehaviour.
1 parent 533fb1c commit a052416

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,12 @@ internal override void OnSpawned()
415415
{
416416
// Assure any changes made to any NetworkVariable during spawn or post-spawn are
417417
// serialized with the CreateObjectMessage.
418-
m_NetworkBehaviour.PostNetworkVariableWrite(true);
418+
if (IsDirty() && CanSend())
419+
{
420+
UpdateLastSentTime();
421+
ResetDirty();
422+
SetDirty(false);
423+
}
419424
base.OnSpawned();
420425
}
421426
}

0 commit comments

Comments
 (0)