Skip to content

Commit 0abd90c

Browse files
docs: plainer wording for the comments this PR adds
1 parent ab4234e commit 0abd90c

6 files changed

Lines changed: 12 additions & 13 deletions

File tree

‎com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedBootstrap.cs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@ public override bool Initialize(string defaultWorldName)
107107
}
108108

109109
/// <summary>
110-
/// Creates the world a <see cref="NetworkManager"/> runs its hybrid session in.
110+
/// Creates the world used by a <see cref="NetworkManager"/>'s hybrid session.
111111
/// </summary>
112112
/// <remarks>
113-
/// A server, host or not, runs in a single world host, except in a dedicated server build, where Netcode for
114-
/// Entities cannot create a world that is also a client. A build for only one side cannot run a host.
113+
/// A server or host uses a single world host. A dedicated server build uses a server-only world instead, because
114+
/// Netcode for Entities cannot create a client world there. A build that only targets the client or the server
115+
/// cannot start a host.
115116
/// </remarks>
116117
private static World CreateWorld(NetworkManager networkManager)
117118
{

‎com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedUpdateConnections.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public void SendMessage<T>(T message) where T : unmanaged, IRpcCommand
2626
}
2727

2828
/// <summary>
29-
/// The <see cref="NetworkManager"/> a hybrid session's world was created for, as a singleton in that world.
29+
/// This is used to track the <see cref="NetworkManager"/>, as a singleton, when running a hybrid session.
3030
/// </summary>
3131
internal struct HybridNetworkManager : IComponentData
3232
{
3333
public UnityObjectRef<NetworkManager> NetworkManager;
3434
}
3535

36-
// Created only in client and server worlds, and updated only in one a NetworkManager created for a hybrid session.
36+
// Only exists in client and server worlds, and only updates in a world created for a hybrid session.
3737
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation | WorldSystemFilterFlags.ClientSimulation)]
3838
internal partial class UnifiedUpdateConnections : SystemBase
3939
{
@@ -53,7 +53,7 @@ protected override void OnUpdate()
5353
{
5454
var commandBuffer = new EntityCommandBuffer(Allocator.Temp);
5555
var networkManager = m_HybridNetworkManagerQuery.GetSingleton<HybridNetworkManager>().NetworkManager.Value;
56-
// The world outlives its NetworkManager if ShutdownInternal throws before disposing it.
56+
// A missing NetworkManager counts as shutting down: the world outlives it if ShutdownInternal throws before disposing the world.
5757
var isShuttingDown = !networkManager || networkManager.ShutdownInProgress || !networkManager.IsListening;
5858
foreach (var (networkId, connectionState, entity) in SystemAPI.Query<NetworkId, ConnectionState>().WithNone<NetworkStreamConnection>().WithEntityAccess())
5959
{
@@ -118,7 +118,7 @@ protected override void OnUpdate()
118118
// make sure we have disconnected all known connections.
119119
if (isShuttingDown)
120120
{
121-
// Only connections that went in-game have ConnectionState, which is removed here, so each is reported once.
121+
// Only in-game connections have ConnectionState, and removing it here means each one is only reported once.
122122
foreach (var (networkId, entity) in SystemAPI.Query<NetworkId>().WithAll<ConnectionState>().WithEntityAccess())
123123
{
124124
commandBuffer.RemoveComponent<ConnectionState>(entity);

‎com.unity.netcode.gameobjects/Runtime/Timing/NetworkTimeSystem.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public bool Advance(double deltaTimeSec)
263263
// Move each offset toward its target by at most AdjustmentRatio of this frame's delta, stopping once it gets there.
264264
// Stepping the full amount every frame overshot the target, so a synced clock alternated between running fast and
265265
// slow, and anything driven by it juddered.
266-
// A negative step would make Math.Clamp throw, so a negative delta or AdjustmentRatio adjusts nothing.
266+
// Math.Clamp throws on a negative step, so a negative delta or AdjustmentRatio applies no adjustment.
267267
var maximumStep = Math.Max(0.0, deltaTimeSec * AdjustmentRatio);
268268
m_CurrentLocalTimeOffset += Math.Clamp(m_DesiredLocalTimeOffset - m_CurrentLocalTimeOffset, -maximumStep, maximumStep);
269269
m_CurrentServerTimeOffset += Math.Clamp(m_DesiredServerTimeOffset - m_CurrentServerTimeOffset, -maximumStep, maximumStep);

‎com.unity.netcode.gameobjects/Runtime/Transports/Unified/UnifiedNetcodeTransport.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public override void DisconnectLocalClient()
476476
public override ulong GetCurrentRtt(ulong clientId)
477477
{
478478
var (transportId, _) = m_NetworkManager.ConnectionManager.ClientIdToTransportId(clientId);
479-
// A message handled after the connection was removed (for example while shutting down) has no RTT, as with UnityTransport.
479+
// Returns 0 when the connection was already removed (for example while shutting down), the same as UnityTransport.
480480
return m_Connections.TryGetValue((int)transportId, out ConnectionInfo connectionInfo) ? (ulong)connectionInfo.Connection.RTT : 0;
481481
}
482482

‎com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/UnifiedNetworkTransformTest.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public IEnumerator BasicMovementTest()
102102
}
103103

104104
/// <summary>
105-
/// Validates that each <see cref="NetworkManager"/>'s world updates the connections of that
106-
/// <see cref="NetworkManager"/> alone.
105+
/// Validates that each <see cref="NetworkManager"/>'s world only updates that <see cref="NetworkManager"/>'s connections.
107106
/// </summary>
108107
[Test]
109108
public void EachWorldUpdatesConnectionsForItsOwnNetworkManager()

‎com.unity.netcode.gameobjects/Tests/Runtime/Unified/UnifiedUpdateConnectionsTests.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public void OneTimeSetup()
2121
}
2222

2323
/// <summary>
24-
/// Validates that a session without ghost prefabs leaves no world with a <see cref="UnifiedUpdateConnections"/>
25-
/// system.
24+
/// Validates that no world has a <see cref="UnifiedUpdateConnections"/> system when the session has no ghost prefabs.
2625
/// </summary>
2726
[UnityTest]
2827
public IEnumerator NoWorldUpdatesConnectionsWithoutGhostPrefabs()

0 commit comments

Comments
 (0)