Skip to content

Commit 3cf7e7a

Browse files
committed
Final fixes
1 parent 7579be9 commit 3cf7e7a

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,7 @@ private void ProcessNetworkBehaviour(TypeDefinition typeDefinition, string[] ass
14311431
MethodReference callMethod = rpcHandler;
14321432
if (typeDefinition.HasGenericParameters)
14331433
{
1434-
var genericTypes = new List<TypeReference>();
1435-
genericTypes.AddRange(typeDefinition.GenericParameters);
1434+
var genericTypes = new List<TypeReference>(typeDefinition.GenericParameters);
14361435
callMethod = callMethod.MakeGeneric(genericTypes.ToArray());
14371436
}
14381437

@@ -3098,8 +3097,7 @@ private MethodDefinition GenerateStaticHandler(MethodDefinition methodDefinition
30983097
var callMethod = (MethodReference)methodDefinition;
30993098
if (castType.HasGenericParameters)
31003099
{
3101-
var genericTypes = new List<TypeReference>();
3102-
genericTypes.AddRange(castType.GenericParameters);
3100+
var genericTypes = new List<TypeReference>(castType.GenericParameters);
31033101
castType = castType.MakeGenericInstanceType(genericTypes.ToArray());
31043102
callMethod = callMethod.MakeGeneric(genericTypes.ToArray());
31053103
}

com.unity.netcode.gameobjects/Runtime/Components/Helpers/AttachableBehaviour.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,7 @@ internal void InternalDetach()
463463
{
464464
// Set the original parent and origianl local position and rotation
465465
transform.SetParent(m_DefaultParent.transform, false);
466-
transform.localPosition = m_OriginalLocalPosition;
467-
transform.localRotation = m_OriginalLocalRotation;
466+
transform.SetLocalPositionAndRotation(m_OriginalLocalPosition, m_OriginalLocalRotation);
468467
}
469468
m_AttachState = AttachState.Detached;
470469
}

testproject/Assets/Tests/Manual/InSceneObjectParentingTests/ChildObjectScript.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ public override void OnNetworkObjectParentChanged(NetworkObject parentNetworkObj
6565
{
6666
// This preserves the original position offset of the object when parented with
6767
// WorldPositionStays set to false.
68-
transform.localPosition = m_OriginalLocalPosition;
68+
transform.SetLocalPositionAndRotation(m_OriginalLocalPosition, m_OriginalLocalRotation);
6969

70-
// Optionally, you can also make other modifications to rotation or scale
71-
transform.localRotation = m_OriginalLocalRotation;
70+
// Optionally, you can also make other modifications to scale
7271
transform.localScale = m_OriginalLocalScale;
7372
}
7473
else if (parentNetworkObject == null && m_LastParent)

0 commit comments

Comments
 (0)