Skip to content

Commit 8db4df0

Browse files
committed
Reformat code to fix Standards check
1 parent 75e1cf3 commit 8db4df0

11 files changed

Lines changed: 103 additions & 103 deletions

File tree

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,23 +2026,23 @@ private bool ApplyTransformToNetworkStateWithInfo(ref NetworkTransformState netw
20262026
}
20272027
}
20282028
else // Just apply the full local scale when synchronizing
2029-
if (SynchronizeScale)
2030-
{
2031-
if (!UseHalfFloatPrecision)
2032-
{
2033-
networkState.ScaleX = transform.localScale.x;
2034-
networkState.ScaleY = transform.localScale.y;
2035-
networkState.ScaleZ = transform.localScale.z;
2036-
}
2037-
else
2029+
if (SynchronizeScale)
20382030
{
2039-
networkState.Scale = transform.localScale;
2031+
if (!UseHalfFloatPrecision)
2032+
{
2033+
networkState.ScaleX = transform.localScale.x;
2034+
networkState.ScaleY = transform.localScale.y;
2035+
networkState.ScaleZ = transform.localScale.z;
2036+
}
2037+
else
2038+
{
2039+
networkState.Scale = transform.localScale;
2040+
}
2041+
networkState.HasScaleX = true;
2042+
networkState.HasScaleY = true;
2043+
networkState.HasScaleZ = true;
2044+
isScaleDirty = true;
20402045
}
2041-
networkState.HasScaleX = true;
2042-
networkState.HasScaleY = true;
2043-
networkState.HasScaleZ = true;
2044-
isScaleDirty = true;
2045-
}
20462046
isDirty |= isPositionDirty || isRotationDirty || isScaleDirty;
20472047

20482048
if (isDirty)
@@ -2768,10 +2768,10 @@ private void NetworkTickSystem_Tick()
27682768
m_TargetPosition = GetSpaceRelativePosition();
27692769
}
27702770
else // If we are no longer authority, unsubscribe to the tick event
2771-
if (NetworkManager != null && NetworkManager.NetworkTickSystem != null)
2772-
{
2773-
NetworkManager.NetworkTickSystem.Tick -= NetworkTickSystem_Tick;
2774-
}
2771+
if (NetworkManager != null && NetworkManager.NetworkTickSystem != null)
2772+
{
2773+
NetworkManager.NetworkTickSystem.Tick -= NetworkTickSystem_Tick;
2774+
}
27752775
}
27762776

27772777
/// <inheritdoc/>

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,10 +1152,10 @@ internal void WriteNetworkVariableData(FastBufferWriter writer, ulong targetClie
11521152
}
11531153
}
11541154
else // Only if EnsureNetworkVariableLengthSafety, otherwise just skip
1155-
if (NetworkManager.NetworkConfig.EnsureNetworkVariableLengthSafety)
1156-
{
1157-
writer.WriteValueSafe(0);
1158-
}
1155+
if (NetworkManager.NetworkConfig.EnsureNetworkVariableLengthSafety)
1156+
{
1157+
writer.WriteValueSafe(0);
1158+
}
11591159
}
11601160
}
11611161

@@ -1183,10 +1183,10 @@ internal void SetNetworkVariableData(FastBufferReader reader, ulong clientId)
11831183
readStartPos = reader.Position;
11841184
}
11851185
else // If the client cannot read this field, then skip it
1186-
if (!field.CanClientRead(clientId))
1187-
{
1188-
continue;
1189-
}
1186+
if (!field.CanClientRead(clientId))
1187+
{
1188+
continue;
1189+
}
11901190

11911191
field.ReadField(reader);
11921192

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,31 +1179,31 @@ private void OnTransformParentChanged()
11791179
Debug.LogException(new NotServerException($"Only the server can reparent {nameof(NetworkObject)}s"));
11801180
}
11811181
else // Otherwise, if we are removing a parent then go ahead and allow parenting to occur
1182-
if (transform.parent == null)
1183-
{
1184-
m_LatestParent = null;
1185-
m_CachedParent = null;
1186-
InvokeBehaviourOnNetworkObjectParentChanged(null);
1187-
}
1182+
if (transform.parent == null)
1183+
{
1184+
m_LatestParent = null;
1185+
m_CachedParent = null;
1186+
InvokeBehaviourOnNetworkObjectParentChanged(null);
1187+
}
11881188
return;
11891189
}
11901190
else // Otherwise, on the serer side if this instance is not spawned...
1191-
if (!IsSpawned)
1192-
{
1193-
// ,,,and we are removing the parent, then go ahead and allow parenting to occur
1194-
if (transform.parent == null)
1191+
if (!IsSpawned)
11951192
{
1196-
m_LatestParent = null;
1197-
m_CachedParent = null;
1198-
InvokeBehaviourOnNetworkObjectParentChanged(null);
1199-
}
1200-
else
1201-
{
1202-
transform.parent = m_CachedParent;
1203-
Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be reparented after being spawned"));
1193+
// ,,,and we are removing the parent, then go ahead and allow parenting to occur
1194+
if (transform.parent == null)
1195+
{
1196+
m_LatestParent = null;
1197+
m_CachedParent = null;
1198+
InvokeBehaviourOnNetworkObjectParentChanged(null);
1199+
}
1200+
else
1201+
{
1202+
transform.parent = m_CachedParent;
1203+
Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be reparented after being spawned"));
1204+
}
1205+
return;
12041206
}
1205-
return;
1206-
}
12071207
var removeParent = false;
12081208
var parentTransform = transform.parent;
12091209
if (parentTransform != null)
@@ -1317,25 +1317,25 @@ internal bool ApplyNetworkParenting(bool removeParent = false, bool ignoreNotSpa
13171317
return true;
13181318
}
13191319
else // If the parent still isn't spawned add this to the orphaned children and return false
1320-
if (!parentNetworkObject.IsSpawned)
1321-
{
1322-
OrphanChildren.Add(this);
1323-
return false;
1324-
}
1325-
else
1326-
{
1327-
// If we made it this far, go ahead and set the network parenting values
1328-
// with the WorldPoisitonSays value set to false
1329-
// Note: Since in-scene placed NetworkObjects are parented in the scene
1330-
// the default "assumption" is that children are parenting local space
1331-
// relative.
1332-
SetNetworkParenting(parentNetworkObject.NetworkObjectId, false);
1320+
if (!parentNetworkObject.IsSpawned)
1321+
{
1322+
OrphanChildren.Add(this);
1323+
return false;
1324+
}
1325+
else
1326+
{
1327+
// If we made it this far, go ahead and set the network parenting values
1328+
// with the WorldPoisitonSays value set to false
1329+
// Note: Since in-scene placed NetworkObjects are parented in the scene
1330+
// the default "assumption" is that children are parenting local space
1331+
// relative.
1332+
SetNetworkParenting(parentNetworkObject.NetworkObjectId, false);
13331333

1334-
// Set the cached parent
1335-
m_CachedParent = parentNetworkObject.transform;
1334+
// Set the cached parent
1335+
m_CachedParent = parentNetworkObject.transform;
13361336

1337-
return true;
1338-
}
1337+
return true;
1338+
}
13391339
}
13401340

13411341
// If we are removing the parent or our latest parent is not set, then remove the parent
@@ -2076,16 +2076,16 @@ internal void SceneChangedUpdate(Scene scene, bool notify = false)
20762076
NetworkSceneHandle = SceneOriginHandle;
20772077
}
20782078
else // Otherwise, the client did not find the client to server scene handle
2079-
if (NetworkManager.LogLevel == LogLevel.Developer)
2080-
{
2081-
// There could be a scenario where a user has some client-local scene loaded that they migrate the NetworkObject
2082-
// into, but that scenario seemed very edge case and under most instances a user should be notified that this
2083-
// server - client scene handle mismatch has occurred. It also seemed pertinent to make the message replicate to
2084-
// the server-side too.
2085-
NetworkLog.LogWarningServer($"[Client-{NetworkManager.LocalClientId}][{gameObject.name}] Server - " +
2086-
$"client scene mismatch detected! Client-side scene handle ({SceneOriginHandle}) for scene ({gameObject.scene.name})" +
2087-
$"has no associated server side (network) scene handle!");
2088-
}
2079+
if (NetworkManager.LogLevel == LogLevel.Developer)
2080+
{
2081+
// There could be a scenario where a user has some client-local scene loaded that they migrate the NetworkObject
2082+
// into, but that scenario seemed very edge case and under most instances a user should be notified that this
2083+
// server - client scene handle mismatch has occurred. It also seemed pertinent to make the message replicate to
2084+
// the server-side too.
2085+
NetworkLog.LogWarningServer($"[Client-{NetworkManager.LocalClientId}][{gameObject.name}] Server - " +
2086+
$"client scene mismatch detected! Client-side scene handle ({SceneOriginHandle}) for scene ({gameObject.scene.name})" +
2087+
$"has no associated server side (network) scene handle!");
2088+
}
20892089
OnMigratedToNewScene?.Invoke();
20902090

20912091
// Only the server side will notify clients of non-parented NetworkObject scene changes

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private protected void SendMessageToClient(NetworkBehaviour behaviour, ulong cli
5454
#if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE
5555
var size =
5656
#endif
57-
behaviour.NetworkManager.MessageManager.SendMessage(ref message, delivery, clientId);
57+
behaviour.NetworkManager.MessageManager.SendMessage(ref message, delivery, clientId);
5858

5959
#if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE
6060
if (NetworkBehaviour.__rpc_name_table[behaviour.GetType()].TryGetValue(message.Metadata.NetworkRpcMethodId, out var rpcMethodName))

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message,
2121
#if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE
2222
var size =
2323
#endif
24-
behaviour.NetworkManager.MessageManager.SendMessage(ref proxyMessage, delivery, NetworkManager.ServerClientId);
24+
behaviour.NetworkManager.MessageManager.SendMessage(ref proxyMessage, delivery, NetworkManager.ServerClientId);
2525

2626
#if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE
2727
if (NetworkBehaviour.__rpc_name_table[behaviour.GetType()].TryGetValue(message.Metadata.NetworkRpcMethodId, out var rpcMethodName))

com.unity.netcode.gameobjects/Runtime/SceneManagement/DefaultSceneManagerHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,13 @@ public void SetClientSynchronizationMode(ref NetworkManager networkManager, Load
342342
return;
343343
}
344344
else // Warn users if they are changing this after there are clients already connected and synchronized
345-
if (networkManager.ConnectedClientsIds.Count > (networkManager.IsHost ? 1 : 0) && sceneManager.ClientSynchronizationMode != mode)
346-
{
347-
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
345+
if (networkManager.ConnectedClientsIds.Count > (networkManager.IsHost ? 1 : 0) && sceneManager.ClientSynchronizationMode != mode)
348346
{
349-
NetworkLog.LogWarning("Server is changing client synchronization mode after clients have been synchronized! It is recommended to do this before clients are connected!");
347+
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
348+
{
349+
NetworkLog.LogWarning("Server is changing client synchronization mode after clients have been synchronized! It is recommended to do this before clients are connected!");
350+
}
350351
}
351-
}
352352

353353
// For additive client synchronization, we take into consideration scenes
354354
// already loaded.

com.unity.netcode.gameobjects/Runtime/Spawning/NetworkPrefabHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,10 @@ internal void HandleNetworkPrefabDestroy(NetworkObject networkObjectInstance)
288288
}
289289
}
290290
else // Otherwise the NetworkObject is the source NetworkPrefab
291-
if (m_PrefabAssetToPrefabHandler.TryGetValue(networkObjectInstanceHash, out var prefabInstanceHandler))
292-
{
293-
prefabInstanceHandler.Destroy(networkObjectInstance);
294-
}
291+
if (m_PrefabAssetToPrefabHandler.TryGetValue(networkObjectInstanceHash, out var prefabInstanceHandler))
292+
{
293+
prefabInstanceHandler.Destroy(networkObjectInstance);
294+
}
295295
}
296296

297297
/// <summary>

com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,10 +1024,10 @@ internal void DespawnAndDestroyNetworkObjects()
10241024
OnDespawnObject(networkObjects[i], shouldDestroy);
10251025
}
10261026
else // Otherwise, if we are not spawned and we should destroy...then destroy.
1027-
if (shouldDestroy)
1028-
{
1029-
UnityEngine.Object.Destroy(networkObjects[i].gameObject);
1030-
}
1027+
if (shouldDestroy)
1028+
{
1029+
UnityEngine.Object.Destroy(networkObjects[i].gameObject);
1030+
}
10311031
}
10321032
}
10331033
}

testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPool.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,11 @@ public void UpdateSpawnsPerSecond()
496496
StartSpawningBoxes();
497497
}
498498
else //Handle case where spawning coroutine is running but we set our spawn rate to zero
499-
if (SpawnsPerSecond == 0 && m_IsSpawningObjects)
500-
{
501-
m_IsSpawningObjects = false;
502-
StopCoroutine(SpawnObjects());
503-
}
499+
if (SpawnsPerSecond == 0 && m_IsSpawningObjects)
500+
{
501+
m_IsSpawningObjects = false;
502+
StopCoroutine(SpawnObjects());
503+
}
504504
}
505505
}
506506

testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPoolAdditive.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ public void UpdateSpawnsPerSecond()
343343
StartSpawningBoxes();
344344
}
345345
else //Handle case where spawning coroutine is running but we set our spawn rate to zero
346-
if (SpawnsPerSecond == 0 && m_IsSpawningObjects)
347-
{
348-
m_IsSpawningObjects = false;
349-
InternalStopCoroutine();
350-
}
346+
if (SpawnsPerSecond == 0 && m_IsSpawningObjects)
347+
{
348+
m_IsSpawningObjects = false;
349+
InternalStopCoroutine();
350+
}
351351

352352
}
353353

0 commit comments

Comments
 (0)