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
{{ message }}
Repository navigation
Commit 503255b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
18
18
19
19
### Fixed
20
20
21
+
- Fixed issue where a prefab added to a `NetworkPrefabsList` while a session was running was registered more than once and logged a duplicate `GlobalObjectIdHash` error. (#4184)
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/Runtime/Components/NetworkRigidBodyBase.cs
+85-27Lines changed: 85 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,6 @@ public abstract class NetworkRigidbodyBase : NetworkBehaviour
21
21
internalboolNetworkRigidbodyBaseExpanded;
22
22
#endif
23
23
24
-
// TODO-UNIFIED:
25
-
// Provide an option to automatically remove the NetworkRigidbodyBase component at runtime if it is a hybrid prefab that is spawned since this
26
-
// component is primarily used for the Rigidbody interpolation and extrapolation features of NetworkTransform which are not relevant for a hybrid
27
-
// prefab that is spawned since it will be using N4E's built in interpolation and extrapolation features. This greatly improves performance on
28
-
// the client side. If using N4E prediction or distributed authority mode, then Rigibody and any component derived from this should always be used.
29
-
30
-
31
24
/// <summary>
32
25
/// When enabled, the associated <see cref="NetworkTransform"/> will use the Rigidbody/Rigidbody2D to apply and synchronize changes in position, rotation, and
33
26
/// allows for the use of Rigidbody interpolation/extrapolation.
// Keep track of the original kinematic state. (see OnDestroy)
264
-
m_OriginalKinematicState=IsKinematic();
265
-
#endif
266
271
SetIsKinematic(true);
267
272
}
268
273
}
274
+
#endif
269
275
270
276
#if UNIFIED_NETCODE
277
+
// The authored kinematic state, restored in OnDestroy.
278
+
privateboolm_OriginalKinematicState;
279
+
280
+
/// <summary>
281
+
/// Skips initialization on a hybrid prefab, whose GhostObject drives its motion. The component stays so <see cref="NetworkBehaviour.NetworkBehaviourId"/> values match on every peer.
282
+
/// </summary>
283
+
/// <returns>true for a hybrid prefab</returns>
284
+
privateboolInitializeHybrid()
285
+
{
286
+
if(NetworkObject==null||!NetworkObject.HasGhost)
287
+
{
288
+
returnfalse;
289
+
}
290
+
291
+
// Clears any registration left behind by a prior Initialize call.
292
+
if(NetworkTransform!=null)
293
+
{
294
+
NetworkTransform.UnregisterRigidbody();
295
+
}
296
+
297
+
m_OriginalKinematicState=IsKinematic();
298
+
returntrue;
299
+
}
300
+
301
+
/// <summary>
302
+
/// Kinematic on every peer except the server. Called at spawn because an in-scene placed instance has no session during Awake.
303
+
/// </summary>
304
+
privatevoidSetHybridKinematicState()
305
+
{
306
+
if(!m_LocalNetworkManager.IsServer)
307
+
{
308
+
SetIsKinematic(true);
309
+
}
310
+
}
311
+
312
+
/// <inheritdoc/>
271
313
publicoverridevoidOnDestroy()
272
314
{
273
315
base.OnDestroy();
274
-
// If the user has left this component on their prefab and this is a hybrid prefab,
275
-
// then we want to set the rigid body back to its original kinematic settings since
276
-
// we are automatically destroying these components at runtime when it is a hybrid
0 commit comments