You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: clamp spawntimeout to recommended range (#3174)
* update
Clamping spawntimeout
* update
improving parenting failed message when either the child or parent NetworkObject is not spawnd.
* update
Update the local SceneEventData.SceneEventType on the authority side for SceneLoadComplete.
* style
removing whitespaces
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/Runtime/Configuration/NetworkConfig.cs
+25Lines changed: 25 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,14 @@ namespace Unity.Netcode
13
13
[Serializable]
14
14
publicclassNetworkConfig
15
15
{
16
+
// Clamp spawn time outs to prevent dropping messages during scene events
17
+
// Note: The legacy versions of NGO defaulted to 1s which was too low. As
18
+
// well, the SpawnTimeOut is now being clamped to within this recommended
19
+
// range both via UI and when NetworkManager is validated.
20
+
internalconstfloatMinSpawnTimeout=10.0f;
21
+
// Clamp spawn time outs to no more than 1 hour (really that is a bit high)
22
+
internalconstfloatMaxSpawnTimeout=3600.0f;
23
+
16
24
/// <summary>
17
25
/// The protocol version. Different versions doesn't talk to each other.
18
26
/// </summary>
@@ -132,6 +140,8 @@ public class NetworkConfig
132
140
/// The amount of time a message will be held (deferred) if the destination NetworkObject needed to process the message doesn't exist yet. If the NetworkObject is not spawned within this time period, all deferred messages for that NetworkObject will be dropped.
133
141
/// </summary>
134
142
[Tooltip("The amount of time a message will be held (deferred) if the destination NetworkObject needed to process the message doesn't exist yet. If the NetworkObject is not spawned within this time period, all deferred messages for that NetworkObject will be dropped.")]
143
+
144
+
[Range(MinSpawnTimeout,MaxSpawnTimeout)]
135
145
publicfloatSpawnTimeout=10f;
136
146
137
147
/// <summary>
@@ -176,6 +186,21 @@ public class NetworkConfig
176
186
[Tooltip("Enable (default) if you want to profile network messages with development builds and defaults to being disabled in release builds. When disabled, network messaging profiling will be disabled in development builds.")]
177
187
publicboolNetworkProfilingMetrics=true;
178
188
189
+
/// <summary>
190
+
/// Invoked by <see cref="NetworkManager"/> when it is validated.
191
+
/// </summary>
192
+
/// <remarks>
193
+
/// Used to check for potential legacy values that have already been serialized and/or
194
+
/// runtime modifications to a property outside of the recommended range.
195
+
/// For each property checked below, provide a brief description of the reason.
196
+
/// </remarks>
197
+
internalvoidOnValidate()
198
+
{
199
+
// Legacy NGO versions defaulted this value to 1 second that has since been determiend
200
+
// any range less than 10 seconds can lead to dropped messages during scene events.
0 commit comments