Skip to content

Commit 49e605e

Browse files
style
Some comment clean up.
1 parent 69a99a9 commit 49e605e

5 files changed

Lines changed: 24 additions & 25 deletions

File tree

com.unity.netcode.gameobjects/Editor/Configuration/HybridNetcodeConfigApplier.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@
66
namespace Unity.Netcode.GameObjects.Editor.Configuration
77
{
88
/// <summary>
9-
/// Keeps the project's <see cref="NetCodeConfig"/> aligned with what NGO needs whenever the project is running in
10-
/// hybrid mode (Netcode for Entities installed, and at least one registered network prefab carrying a ghost).
9+
/// Keeps the project's <see cref="NetCodeConfig"/> aligned with NGO needs whenever the project is running in
10+
/// hybrid mode (N4E installed and at least one registered NGO network prefab has a GhostObject component).
1111
/// </summary>
1212
/// <remarks>
13-
/// This never creates a <see cref="NetCodeConfig"/>. Netcode for Entities already creates one unconditionally from
14-
/// its own <see cref="InitializeOnLoadMethodAttribute"/>, and creating a second lands the project in N4E's
15-
/// multiple-config error path. We find the one N4E settled on and correct it.
13+
/// This does not create <see cref="NetCodeConfig"/>. This finds the one N4E created and modifies it.
1614
/// </remarks>
1715
internal static class HybridNetcodeConfigApplier
1816
{
1917
[InitializeOnLoadMethod]
2018
private static void OnApplicationStart()
2119
{
22-
// N4E creates and assigns the global config from its own InitializeOnLoadMethod. Cross-assembly ordering
23-
// between the two is not a documented contract, so defer rather than racing it.
20+
// Cross-assembly ordering between the two is not a documented contract.
21+
// Defer rather than racing it.
2422
EditorApplication.delayCall += OnDelayCall;
2523
}
2624

@@ -31,12 +29,13 @@ private static void OnDelayCall()
3129
}
3230

3331
/// <summary>
34-
/// Corrects the global <see cref="NetCodeConfig"/> for hybrid mode, if this is a hybrid project.
32+
/// Adjusts <see cref="NetCodeConfig"/> for NGO hybrid mode.
3533
/// </summary>
3634
/// <param name="applyRecommended">
37-
/// When true, re-applies the full tuned set even if this project has already had it applied once. Driven by the
38-
/// button in Project Settings. When false, the tuned values are only written the first time, so that a user's
39-
/// own edits are not repeatedly overwritten.
35+
/// Driven by the button in Project Settings:
36+
/// - When true: it re-applies the full tuned set even if this project has already had it applied once.
37+
/// - When false: default NGO settings are only written once, the first time they are applied. From that
38+
/// point forward, the user's edits are not overwritten.
4039
/// </param>
4140
internal static void Apply(bool applyRecommended)
4241
{
@@ -91,7 +90,6 @@ internal static void Apply(bool applyRecommended)
9190
/// <summary>
9291
/// True when any <see cref="NetworkManager"/> in the project has a registered prefab carrying a ghost.
9392
/// </summary>
94-
/// <returns>Whether this project is configured for hybrid mode.</returns>
9593
internal static bool IsHybridProject()
9694
{
9795
foreach (var networkManager in Resources.FindObjectsOfTypeAll<NetworkManager>())
@@ -140,7 +138,7 @@ private static bool HasGhost(NetworkPrefab prefab)
140138
/// <summary>
141139
/// Resolves the config N4E considers global, falling back to a project scan when N4E has not assigned one yet.
142140
/// </summary>
143-
/// <returns>The config to correct, or null when none exists yet.</returns>
141+
/// <returns>The config to adjust or null if no config exists.</returns>
144142
internal static NetCodeConfig ResolveGlobalConfig()
145143
{
146144
if (NetCodeConfig.Global != null)
@@ -153,7 +151,9 @@ internal static NetCodeConfig ResolveGlobalConfig()
153151
}
154152

155153
/// <summary>
156-
/// The tick rate N4E should be driven at. NGO owns this, so it comes from <see cref="NetworkConfig.TickRate"/>.
154+
/// Returns either the current N4E tick rate or the NGO <see cref="NetworkConfig.TickRate"/>.
155+
/// If no NetworkManager is found yet, it returns N4E's tick rate.
156+
/// If a NetworkManager is found, then it returns NGO's tick rate.
157157
/// </summary>
158158
/// <param name="config">The config, used as the fallback when no NetworkManager can be found.</param>
159159
/// <returns>The tick rate to write into the config.</returns>

com.unity.netcode.gameobjects/Editor/Configuration/NetcodeForGameObjectsProjectSettings.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ private void OnEnable()
3737

3838
#if UNIFIED_NETCODE
3939
/// <summary>
40-
/// The version of the NGO hybrid mode defaults already applied to this project's NetCodeConfig.
40+
/// The hybrid mode default values already applied to this project's NetCodeConfig.
4141
/// </summary>
4242
/// <remarks>
43-
/// Zero means they have never been applied. Recording it is what keeps the tuned values a one-shot, so that a
44-
/// user who deliberately changes them does not have them overwritten on the next domain reload.
43+
/// Zero means they have never been applied. Persisting this value is what keeps the tuned values a one-shot.
44+
/// For users who deliberately change them, they are not overwritten on the next domain reload.
4545
/// </remarks>
4646
[SerializeField]
4747
public int HybridDefaultsVersion;

com.unity.netcode.gameobjects/Editor/Configuration/NetcodeSettingsProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ private static void OnGuiHandler(string obj)
215215

216216
#if UNIFIED_NETCODE
217217
/// <summary>
218-
/// Surfaces the state of the project's NetCodeConfig, and offers a way back to the NGO defaults for anyone who
219-
/// has since changed them.
218+
/// Displays the current state of the project's NetCodeConfig and offers a way to reset back to the
219+
/// NGO default values for anyone who has since changed them.
220220
/// </summary>
221221
/// <param name="settings">The project settings holding the applied-defaults marker.</param>
222222
private static void DrawHybridSettings(NetcodeForGameObjectsProjectSettings settings)

com.unity.netcode.gameobjects/Tests/Editor/HybridNetcodeDefaultsTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Unity.Netcode.EditorTests
88
{
99
/// <summary>
10-
/// Guards the NetCodeConfig values NGO applies in hybrid mode, and the reasoning behind the non-obvious ones.
10+
/// Validates the NetCodeConfig values NGO applies in hybrid mode.
1111
/// </summary>
1212
internal class HybridNetcodeDefaultsTests
1313
{
@@ -84,12 +84,11 @@ public void ApplyRecommendedProducesTheTunedValues()
8484
}
8585

8686
/// <summary>
87-
/// The reason the millisecond form is used rather than <see cref="ClientTickRate.InterpolationTimeNetTicks"/>.
87+
/// Why the millisecond form is used rather than <see cref="ClientTickRate.InterpolationTimeNetTicks"/>.
8888
/// </summary>
8989
/// <remarks>
9090
/// Netcode for Entities rounds the millisecond value up to whole network ticks, so it holds at least the
91-
/// configured wall clock buffer at any tick rate. Two net ticks does not: it is 66.7ms at 30Hz but only 33.3ms
92-
/// at 60Hz, and 33.3ms is the buffer the 2000 instance stress test stuttered at.
91+
/// configured wall clock buffer at any tick rate.
9392
/// </remarks>
9493
/// <param name="tickRate">The tick rate to resolve the buffer against.</param>
9594
[TestCase(30u)]

com.unity.netcode.gameobjects/Tests/Runtime/Unified/UnifiedSnapshotPacketSizeMeasurement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Unity.Netcode.RuntimeTests
1313
{
1414
/// <summary>
15-
/// Measurement harness (not a pass/fail behaviour test) used to size
16-
/// <see cref="NetCode.GhostSendSystemData.DefaultSnapshotPacketSize"/> for hybrid (NGO + N4E) mode.
15+
/// Measurement harness (not a pass/fail behaviour test) used to determine bandwidth consumption based
16+
/// on the <see cref="NetCode.GhostSendSystemData.DefaultSnapshotPacketSize"/> when running in hybrid mode.
1717
/// Spawns N hybrid ghosts, keeps every one of them dirty on every tick, and reads the N4E client-side
1818
/// snapshot metrics singleton for a fixed sample window. Results are emitted as "PKTSZ|" log lines.
1919
/// </summary>

0 commit comments

Comments
 (0)