66namespace 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>
0 commit comments