Skip to content

Commit ecd19a0

Browse files
Update networkvariable.md
Fixes to the example script
1 parent 6658dc1 commit ecd19a0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

com.unity.netcode.gameobjects/Documentation~/basics/networkvariable.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public class Door : NetworkBehaviour
204204
protected override void OnNetworkPostSpawn()
205205
{
206206
// Everyone updates their door state when finished spawning the door.
207-
UpdateFromState();
207+
UpdateFromState(true);
208208
base.OnNetworkPostSpawn();
209209
}
210210

@@ -235,7 +235,7 @@ public class Door : NetworkBehaviour
235235
{
236236
// Update to the current state while also providing a catch for
237237
// the first synchronization where previous == current.
238-
UpdateFromState(previous != current);
238+
UpdateFromState();
239239
}
240240

241241
/// <summary>
@@ -259,8 +259,8 @@ public class Door : NetworkBehaviour
259259
// if first sync, reset to closed and don't play sound
260260
}
261261

262-
// If 1st sync, don't log a message about a change in state
263-
// since previous == current (i.e. no change in state)
262+
// Don't log a message about a change in state when first
263+
// synchronizing.
264264
if (!isFirstSynchronization)
265265
{
266266
var openClosed = State.Value ? "open" : "closed";

0 commit comments

Comments
 (0)