Skip to content

Commit c221156

Browse files
Merge branch 'develop-2.0.0' into chore/findobjectsbytype-no-more-sorting-update
2 parents 5b4f42d + 3491f14 commit c221156

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
2929

3030
### Fixed
3131

32+
- Fixed memory leak in `NetworkAnimator` on clients where `RpcTarget` groups were not being properly disposed due to incorrect type casting of `ProxyRpcTargetGroup` to `RpcTargetGroup`.
3233
- Fixed issue when using a client-server topology where a `NetworkList` with owner write permissions was resetting sent time and dirty flags after having been spawned on owning clients that were not the spawn authority. (#3850)
3334
- Fixed an integer overflow that occurred when configuring a large disconnect timeout with Unity Transport. (#3810)
3435

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ protected virtual bool OnIsServerAuthoritative()
709709
private static byte[] s_EmptyArray = new byte[] { };
710710
private List<int> m_ParametersToUpdate;
711711
private RpcParams m_RpcParams;
712-
private RpcTargetGroup m_TargetGroup;
712+
private IGroupRpcTarget m_TargetGroup;
713713
private AnimationMessage m_AnimationMessage;
714714
private NetworkAnimatorStateChangeHandler m_NetworkAnimatorStateChangeHandler;
715715

@@ -762,7 +762,7 @@ public override void OnDestroy()
762762
{
763763
SpawnCleanup();
764764

765-
m_TargetGroup?.Dispose();
765+
m_TargetGroup?.Target?.Dispose();
766766

767767
if (m_CachedAnimatorParameters != null && m_CachedAnimatorParameters.IsCreated)
768768
{
@@ -928,12 +928,12 @@ public override void OnNetworkSpawn()
928928
NetworkLog.LogWarningServer($"[{gameObject.name}][{nameof(NetworkAnimator)}] {nameof(Animator)} is not assigned! Animation synchronization will not work for this instance!");
929929
}
930930

931-
m_TargetGroup = RpcTarget.Group(new List<ulong>(128), RpcTargetUse.Persistent) as RpcTargetGroup;
931+
m_TargetGroup = RpcTarget.Group(new List<ulong>(128), RpcTargetUse.Persistent) as IGroupRpcTarget;
932932
m_RpcParams = new RpcParams()
933933
{
934934
Send = new RpcSendParams()
935935
{
936-
Target = m_TargetGroup
936+
Target = m_TargetGroup?.Target
937937
}
938938
};
939939

@@ -1219,7 +1219,7 @@ internal void CheckForAnimatorChanges()
12191219
}
12201220
m_TargetGroup.Add(clientId);
12211221
}
1222-
m_RpcParams.Send.Target = m_TargetGroup;
1222+
m_RpcParams.Send.Target = m_TargetGroup.Target;
12231223
SendClientAnimStateRpc(m_AnimationMessage, m_RpcParams);
12241224
}
12251225
}
@@ -1555,7 +1555,7 @@ private unsafe void SendServerParametersUpdateRpc(ParametersUpdateMessage parame
15551555
m_TargetGroup.Add(clientId);
15561556
}
15571557

1558-
m_RpcParams.Send.Target = m_TargetGroup;
1558+
m_RpcParams.Send.Target = m_TargetGroup.Target;
15591559
m_NetworkAnimatorStateChangeHandler.SendParameterUpdate(parametersUpdate, m_RpcParams);
15601560
}
15611561
}
@@ -1621,7 +1621,7 @@ private void SendServerAnimStateRpc(AnimationMessage animationMessage, RpcParams
16211621
}
16221622
m_TargetGroup.Add(clientId);
16231623
}
1624-
m_RpcParams.Send.Target = m_TargetGroup;
1624+
m_RpcParams.Send.Target = m_TargetGroup.Target;
16251625
m_NetworkAnimatorStateChangeHandler.SendAnimationUpdate(animationMessage, m_RpcParams);
16261626
}
16271627
}

0 commit comments

Comments
 (0)