Skip to content

Commit 533fb1c

Browse files
style
Adding comments for clarity of what `OnSpawned` and the call to `PostNetworkVariableWrite` is for. Removing trailing whitespaces.
1 parent 45c10ab commit 533fb1c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,13 @@ internal override void WriteFieldSynchronization(FastBufferWriter writer)
408408
}
409409
}
410410

411+
/// <summary>
412+
/// Notification we have fully spawned the associated <see cref="NetworkObject"/>.
413+
/// </summary>
411414
internal override void OnSpawned()
412415
{
416+
// Assure any changes made to any NetworkVariable during spawn or post-spawn are
417+
// serialized with the CreateObjectMessage.
413418
m_NetworkBehaviour.PostNetworkVariableWrite(true);
414419
base.OnSpawned();
415420
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override void OnNetworkSpawn()
4949
}
5050
else
5151
{
52-
// Only set these values during OnNetworkSpawn to
52+
// Only set these values during OnNetworkSpawn to
5353
// verify this value is valid for non-authority instances.
5454
OnNetworkSpawnValue = TestValueOnSpawn.Value;
5555
OnNetworkPostSpawnValue = TestValueOnPostSpawn.Value;

0 commit comments

Comments
 (0)