Skip to content

Commit 9e43dbe

Browse files
style
Remove commented code. Add additional comments for clarity.
1 parent 901fa4e commit 9e43dbe

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3089,32 +3089,15 @@ protected internal override void InternalOnNetworkPostSpawn()
30893089
// This is a special case for client-server where a server is spawning an owner authoritative NetworkObject but has yet to serialize anything.
30903090
// When the server detects that:
30913091
// - We are not in a distributed authority session (DAHost check).
3092-
// - This is the first/root NetworkTransform.
30933092
// - We are in owner authoritative mode.
30943093
// - The NetworkObject is not owned by the server.
30953094
// - The SynchronizeState.IsSynchronizing is set to false.
30963095
// Then we want to:
30973096
// - Force the "IsSynchronizing" flag so the NetworkTransform has its state updated properly and runs through the initialization again.
30983097
// - Make sure the SynchronizingState is updated to the instantiated prefab's default flags/settings.
3099-
//if (NetworkManager.IsServer && !NetworkManager.DistributedAuthorityMode && m_IsFirstNetworkTransform && !OnIsServerAuthoritative() && !IsOwner && !SynchronizeState.IsSynchronizing)
3100-
//{
3101-
// // Assure the first/root NetworkTransform has the synchronizing flag set so the server runs through the final post initialization steps
3102-
// SynchronizeState.IsSynchronizing = true;
3103-
// // Assure the SynchronizeState matches the initial prefab's values for each associated NetworkTransfrom (this includes root + all children)
3104-
// foreach (var child in NetworkObject.NetworkTransforms)
3105-
// {
3106-
// // Don't ApplyPlayerTransformState to any nested NetworkTransform with a different authority mode
3107-
// if (child != this && child.AuthorityMode != AuthorityMode)
3108-
// {
3109-
// continue;
3110-
// }
3111-
// child.ApplyPlayerTransformState();
3112-
// }
3113-
// // Now fall through to the final synchronization portion of the spawning for NetworkTransform
3114-
//}
3115-
31163098
if (NetworkManager.IsServer && !NetworkManager.DistributedAuthorityMode && !IsOwner && !OnIsServerAuthoritative() && !SynchronizeState.IsSynchronizing)
31173099
{
3100+
// Handle the first/root NetworkTransform slightly differently to have a sequenced synchronization of like authority nested NetworkTransform components
31183101
if (m_IsFirstNetworkTransform)
31193102
{
31203103
// Assure the NetworkTransform has the synchronizing flag set so the server runs through the final post initialization steps
@@ -3139,6 +3122,7 @@ protected internal override void InternalOnNetworkPostSpawn()
31393122
// Now fall through to the final synchronization portion of the spawning for NetworkTransform
31403123
}
31413124

3125+
// Standard non-authority synchronization is handled here
31423126
if (!CanCommitToTransform && NetworkManager.IsConnectedClient && SynchronizeState.IsSynchronizing)
31433127
{
31443128
NonAuthorityFinalizeSynchronization();

0 commit comments

Comments
 (0)