Skip to content

Commit 1914d3c

Browse files
style
Removing whitespaces for PVP-124-2 issues.
1 parent 64195d5 commit 1914d3c

22 files changed

+146
-139
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
215215
## [2.0.0-exp.2] - 2024-04-02
216216

217217
### Added
218-
- Added updates to all internal messages to account for a distributed authority network session connection. (#2863)
219-
- Added `NetworkRigidbodyBase` that provides users with a more customizable network rigidbody, handles both `Rigidbody` and `Rigidbody2D`, and provides an option to make `NetworkTransform` use the rigid body for motion. (#2863)
218+
- Added updates to all internal messages to account for a distributed authority network session connection. (#2863)
219+
- Added `NetworkRigidbodyBase` that provides users with a more customizable network rigidbody, handles both `Rigidbody` and `Rigidbody2D`, and provides an option to make `NetworkTransform` use the rigid body for motion. (#2863)
220220
- For a customized `NetworkRigidbodyBase` class:
221221
- `NetworkRigidbodyBase.AutoUpdateKinematicState` provides control on whether the kinematic setting will be automatically set or not when ownership changes.
222222
- `NetworkRigidbodyBase.AutoSetKinematicOnDespawn` provides control on whether isKinematic will automatically be set to true when the associated `NetworkObject` is despawned.
@@ -352,6 +352,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
352352
- Fixed issue where you could not have multiple source network prefab overrides targeting the same network prefab as their override. (#2710)
353353

354354
### Changed
355+
355356
- Changed the server or host shutdown so it will now perform a "soft shutdown" when `NetworkManager.Shutdown` is invoked. This will send a disconnect notification to all connected clients and the server-host will wait for all connected clients to disconnect or timeout after a 5 second period before completing the shutdown process. (#2789)
356357
- Changed `OnClientDisconnectedCallback` will now return the assigned client identifier on the local client side if the client was approved and assigned one prior to being disconnected. (#2789)
357358
- Changed `NetworkTransform.SetState` (and related methods) now are cumulative during a fractional tick period and sent on the next pending tick. (#2777)
@@ -364,6 +365,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
364365
- Changed in-scene placed `NetworkObject`s now set their `IsSceneObject` value when generating their `GlobalObjectIdHash` value. (#2710)
365366
- Changed the default `NetworkConfig.SpawnTimeout` value from 1.0s to 10.0s. (#2710)
366367

368+
367369
## [1.7.1] - 2023-11-15
368370

369371
### Added
@@ -413,7 +415,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
413415
### Added
414416

415417
- Added a protected virtual method `NetworkTransform.OnInitialize(ref NetworkTransformState replicatedState)` that just returns the replicated state reference.
416-
418+
417419
### Fixed
418420

419421
- Fixed issue where invoking `NetworkManager.Shutdown` within `NetworkManager.OnClientStopped` or `NetworkManager.OnServerStopped` would force `NetworkManager.ShutdownInProgress` to remain true after completing the shutdown process. (#2661)

com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private void DisplayNetworkManagerProperties()
237237
if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority)
238238
{
239239
EditorGUILayout.PropertyField(m_AutoSpawnPlayerPrefabClientSide, new GUIContent("Auto Spawn Player Prefab"));
240-
}
240+
}
241241
#endif
242242
EditorGUILayout.PropertyField(m_PlayerPrefabProperty, new GUIContent("Default Player Prefab"));
243243

com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
193193

194194
// The below can cause visual anomalies and/or throws an exception within the EditorGUI itself (index out of bounds of the array). and has
195195
// The visual anomaly is when you select one field it is set in the drop down but then the flags selection in the popup menu selects more items
196-
// even though if you exit the popup menu the flag setting is correct.
197-
//var ownership = (NetworkObject.OwnershipStatus)EditorGUI.EnumFlagsField(position, label, (NetworkObject.OwnershipStatus)property.enumValueFlag);
198-
//property.enumValueFlag = (int)ownership;
196+
// even though if you exit the popup menu the flag setting is correct.
197+
// var ownership = (NetworkObject.OwnershipStatus)EditorGUI.EnumFlagsField(position, label, (NetworkObject.OwnershipStatus)property.enumValueFlag);
198+
// property.enumValueFlag = (int)ownership;
199199
EditorGUI.EndDisabledGroup();
200200
EditorGUI.EndProperty();
201201
}

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ internal struct AnimationMessage : INetworkSerializable
416416
internal bool HasBeenProcessed;
417417

418418
// This is preallocated/populated in OnNetworkSpawn for all instances in the event ownership or
419-
// authority changes. When serializing, IsDirtyCount determines how many AnimationState entries
420-
// should be serialized from the list. When deserializing the list is created and populated with
419+
// authority changes. When serializing, IsDirtyCount determines how many AnimationState entries
420+
// should be serialized from the list. When deserializing the list is created and populated with
421421
// only the number of AnimationStates received which is dictated by the deserialized IsDirtyCount.
422422
internal List<AnimationState> AnimationStates;
423423

@@ -493,7 +493,7 @@ internal bool IsServerAuthoritative()
493493
}
494494

495495
/// <summary>
496-
/// Override this method and return false to switch to owner authoritative mode
496+
/// Override this method and return false to switch to owner authoritative mode.
497497
/// </summary>
498498
/// <remarks>
499499
/// When using a distributed authority network topology, this will default to
@@ -731,7 +731,7 @@ public override void OnNetworkDespawn()
731731
}
732732

733733
/// <summary>
734-
/// Wries all parameter and state information needed to initially synchronize a client
734+
/// Writes all parameter and state information needed to initially synchronize a client
735735
/// </summary>
736736
private void WriteSynchronizationData<T>(ref BufferSerializer<T> serializer) where T : IReaderWriter
737737
{
@@ -806,8 +806,10 @@ private void WriteSynchronizationData<T>(ref BufferSerializer<T> serializer) whe
806806
}
807807
}
808808

809-
animationState.Transition = isInTransition; // The only time this could be set to true
810-
animationState.StateHash = stateHash; // When a transition, this is the originating/starting state
809+
// The only time this could be set to true
810+
animationState.Transition = isInTransition;
811+
// When a transition, this is the originating/starting state
812+
animationState.StateHash = stateHash;
811813
animationState.NormalizedTime = normalizedTime;
812814
animationState.Layer = layer;
813815
animationState.Weight = m_LayerWeights[layer];
@@ -881,7 +883,8 @@ private void CheckForStateChange(int layer)
881883
{
882884
m_TransitionHash[layer] = nt.fullPathHash;
883885
m_AnimationHash[layer] = 0;
884-
animState.DestinationStateHash = nt.fullPathHash; // Next state is the destination state for cross fade
886+
// Next state is the destination state for cross fade
887+
animState.DestinationStateHash = nt.fullPathHash;
885888
animState.CrossFade = true;
886889
animState.Transition = true;
887890
animState.Duration = tt.duration;
@@ -899,7 +902,8 @@ private void CheckForStateChange(int layer)
899902
// first time in this transition for this layer
900903
m_TransitionHash[layer] = tt.fullPathHash;
901904
m_AnimationHash[layer] = 0;
902-
animState.StateHash = tt.fullPathHash; // Transitioning from state
905+
// Transitioning from state
906+
animState.StateHash = tt.fullPathHash;
903907
animState.CrossFade = false;
904908
animState.Transition = true;
905909
animState.NormalizedTime = tt.normalizedTime;
@@ -1115,7 +1119,7 @@ private unsafe void WriteParameters(ref FastBufferWriter writer)
11151119
{
11161120
writer.Seek(0);
11171121
writer.Truncate();
1118-
// Write how many parameter entries we are going to write
1122+
// Write out how many parameter entries to read
11191123
BytePacker.WriteValuePacked(writer, (uint)m_ParametersToUpdate.Count);
11201124
foreach (var parameterIndex in m_ParametersToUpdate)
11211125
{
@@ -1264,7 +1268,7 @@ internal void UpdateAnimationState(AnimationState animationState)
12641268
NetworkLog.LogError($"[DestinationState To Transition Info] Layer ({animationState.Layer}) sub-table does not contain destination state ({animationState.DestinationStateHash})!");
12651269
}
12661270
}
1267-
// For reference, it is valid to have no transition information
1271+
// For reference, it is valid to have no transition information
12681272
//else if (NetworkManager.LogLevel == LogLevel.Developer)
12691273
//{
12701274
// NetworkLog.LogError($"[DestinationState To Transition Info] Layer ({animationState.Layer}) does not exist!");
@@ -1471,7 +1475,7 @@ private void InternalSetTrigger(int hash, bool isSet = true)
14711475

14721476
/// <summary>
14731477
/// Distributed Authority: Internally-called RPC client receiving function to update a trigger when the server wants to forward
1474-
/// a trigger for a client to play / reset
1478+
/// a trigger to a client
14751479
/// </summary>
14761480
/// <param name="animationTriggerMessage">the payload containing the trigger data to apply</param>
14771481
[Rpc(SendTo.NotAuthority)]
@@ -1482,7 +1486,7 @@ internal void SendAnimTriggerRpc(AnimationTriggerMessage animationTriggerMessage
14821486

14831487
/// <summary>
14841488
/// Client Server: Internally-called RPC client receiving function to update a trigger when the server wants to forward
1485-
/// a trigger for a client to play / reset
1489+
/// a trigger to a client
14861490
/// </summary>
14871491
/// <param name="animationTriggerMessage">the payload containing the trigger data to apply</param>
14881492
/// <param name="clientRpcParams">unused</param>
@@ -1548,7 +1552,7 @@ public void SetTrigger(int hash, bool setTrigger = true)
15481552
}
15491553

15501554
/// <summary>
1551-
/// Resets the trigger for the associated animation. See <see cref="SetTrigger(string)">SetTrigger</see> for more on how triggers are special
1555+
/// Resets the trigger for the associated animation. See <see cref="SetTrigger(string)">SetTrigger</see> for more on how triggers are special
15521556
/// </summary>
15531557
/// <param name="triggerName">The string name of the trigger to reset</param>
15541558
public void ResetTrigger(string triggerName)
@@ -1564,4 +1568,5 @@ public void ResetTrigger(int hash)
15641568
}
15651569
}
15661570
}
1567-
#endif // COM_UNITY_MODULES_ANIMATION
1571+
// COM_UNITY_MODULES_ANIMATION
1572+
#endif

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

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ internal Vector3 GetAdjustedRotationThreshold()
180180
/// </summary>
181181
/// <remarks>
182182
/// For <see cref="Rigidbody2D"/>, only the x and y components of the <see cref="Vector3"/> are applied.
183-
/// </remarks>
183+
/// </remarks>
184184
public void SetLinearVelocity(Vector3 linearVelocity)
185185
{
186186
if (m_IsRigidbody2D)
@@ -546,7 +546,7 @@ public void SetIsKinematic(bool isKinematic)
546546
{
547547
if (IsKinematic())
548548
{
549-
// If not already set to interpolate then set the Rigidbody to interpolate
549+
// If not already set to interpolate then set the Rigidbody to interpolate
550550
if (m_InternalRigidbody.interpolation == RigidbodyInterpolation.Extrapolate)
551551
{
552552
// Sleep until the next fixed update when switching from extrapolation to interpolation
@@ -849,36 +849,30 @@ public void DetachFromFixedJoint()
849849
}
850850
if (UseRigidBodyForMotion)
851851
{
852-
if (m_IsRigidbody2D)
852+
if (m_IsRigidbody2D && FixedJoint2D != null)
853853
{
854-
if (FixedJoint2D != null)
854+
if (!m_FixedJoint2DUsingGravity)
855855
{
856-
if (!m_FixedJoint2DUsingGravity)
857-
{
858-
FixedJoint2D.connectedBody.gravityScale = m_OriginalGravityScale;
859-
}
860-
FixedJoint2D.connectedBody = null;
861-
Destroy(FixedJoint2D);
862-
FixedJoint2D = null;
863-
ResetInterpolation();
864-
RemoveFromParentBody();
856+
FixedJoint2D.connectedBody.gravityScale = m_OriginalGravityScale;
865857
}
858+
FixedJoint2D.connectedBody = null;
859+
Destroy(FixedJoint2D);
860+
FixedJoint2D = null;
861+
ResetInterpolation();
862+
RemoveFromParentBody();
866863
}
867-
else
864+
else if (FixedJoint != null)
868865
{
869-
if (FixedJoint != null)
870-
{
871-
FixedJoint.connectedBody = null;
872-
m_InternalRigidbody.useGravity = m_OriginalGravitySetting;
873-
Destroy(FixedJoint);
874-
FixedJoint = null;
875-
ResetInterpolation();
876-
RemoveFromParentBody();
877-
}
866+
FixedJoint.connectedBody = null;
867+
m_InternalRigidbody.useGravity = m_OriginalGravitySetting;
868+
Destroy(FixedJoint);
869+
FixedJoint = null;
870+
ResetInterpolation();
871+
RemoveFromParentBody();
878872
}
879873
}
880874
}
881875
}
882876
}
883-
#endif // COM_UNITY_MODULES_PHYSICS
884-
877+
// COM_UNITY_MODULES_PHYSICS
878+
#endif

0 commit comments

Comments
 (0)