Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.unity.netcode.gameobjects/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
- `NetworkTransport.EarlyUpdate` and `NetworkTransport.PostLateUpdate` are now public. For the vast majority of users, there's really no point in ever calling those methods directly (the `NetworkManager` handles it). It's only useful if wrapping transports outside of NGO. (#3890)

### Changed

- Improve performance of `NetworkAnimator`. (#3905)

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ internal void DeregisterUpdate()
internal NetworkAnimatorStateChangeHandler(NetworkAnimator networkAnimator)
{
m_NetworkAnimator = networkAnimator;
m_IsServer = networkAnimator.NetworkManager.IsServer;
m_IsServer = networkAnimator.LocalNetworkManager.IsServer;
NetworkUpdateLoop.RegisterNetworkUpdate(this, NetworkUpdateStage.PreUpdate);
}
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public Animator Animator
private Dictionary<int, Dictionary<int, TransitionStateinfo>> m_DestinationStateToTransitioninfo = new Dictionary<int, Dictionary<int, TransitionStateinfo>>();

// Named differently to avoid serialization conflicts with NetworkBehaviour
private NetworkManager m_LocalNetworkManager;
internal NetworkManager LocalNetworkManager;

internal bool DistributedAuthorityMode;

Expand Down Expand Up @@ -915,8 +915,8 @@ internal AnimationMessage GetAnimationMessage()
internal override void InternalOnNetworkPreSpawn(ref NetworkManager networkManager)
{
// Save internal state references
m_LocalNetworkManager = networkManager;
DistributedAuthorityMode = m_LocalNetworkManager.DistributedAuthorityMode;
LocalNetworkManager = networkManager;
DistributedAuthorityMode = LocalNetworkManager.DistributedAuthorityMode;
}

/// <inheritdoc/>
Expand Down Expand Up @@ -1176,7 +1176,7 @@ internal void CheckForAnimatorChanges()

if (m_Animator.runtimeAnimatorController == null)
{
if (m_LocalNetworkManager.LogLevel == LogLevel.Developer)
if (LocalNetworkManager.LogLevel == LogLevel.Developer)
{
Debug.LogError($"[{GetType().Name}] Could not find an assigned {nameof(RuntimeAnimatorController)}! Cannot check {nameof(Animator)} for changes in state!");
}
Expand Down Expand Up @@ -1211,9 +1211,9 @@ internal void CheckForAnimatorChanges()
{
// Just notify all remote clients and not the local server
m_TargetGroup.Clear();
foreach (var clientId in m_LocalNetworkManager.ConnectionManager.ConnectedClientIds)
foreach (var clientId in LocalNetworkManager.ConnectionManager.ConnectedClientIds)
{
if (clientId == m_LocalNetworkManager.LocalClientId || !NetworkObject.Observers.Contains(clientId))
if (clientId == LocalNetworkManager.LocalClientId || !NetworkObject.Observers.Contains(clientId))
{
continue;
}
Expand Down Expand Up @@ -1241,7 +1241,7 @@ private void SendParametersUpdate(RpcParams rpcParams = default, bool sendDirect
}
else
{
Debug.LogError($"[{name}][Client-{m_LocalNetworkManager.LocalClientId}] Attempting to send parameter updates but not the owner!");
Debug.LogError($"[{name}][Client-{LocalNetworkManager.LocalClientId}] Attempting to send parameter updates but not the owner!");
}
}
else
Expand Down Expand Up @@ -1491,18 +1491,18 @@ internal void UpdateAnimationState(AnimationState animationState)
// Cross fade from the current to the destination state for the transitions duration while starting at the server's current normalized time of the transition
m_Animator.CrossFade(transitionStateInfo.DestinationState, transitionStateInfo.TransitionDuration, transitionStateInfo.Layer, 0.0f, animationState.NormalizedTime);
}
else if (m_LocalNetworkManager.LogLevel == LogLevel.Developer)
else if (LocalNetworkManager.LogLevel == LogLevel.Developer)
{
NetworkLog.LogWarning($"Current State Hash ({currentState.fullPathHash}) != AnimationState.StateHash ({animationState.StateHash})");
}
}
else if (m_LocalNetworkManager.LogLevel == LogLevel.Developer)
else if (LocalNetworkManager.LogLevel == LogLevel.Developer)
{
NetworkLog.LogError($"[DestinationState To Transition Info] Layer ({animationState.Layer}) sub-table does not contain destination state ({animationState.DestinationStateHash})!");
}
}
// For reference, it is valid to have no transition information
//else if (NetworkManager.LogLevel == LogLevel.Developer)
//else if (m_LocalNetworkManager.LogLevel == LogLevel.Developer)
//{
// NetworkLog.LogError($"[DestinationState To Transition Info] Layer ({animationState.Layer}) does not exist!");
//}
Expand Down Expand Up @@ -1539,7 +1539,7 @@ private unsafe void SendServerParametersUpdateRpc(ParametersUpdateMessage parame
return;
}
UpdateParameters(ref parametersUpdate);
var connectedClientIds = m_LocalNetworkManager.ConnectionManager.ConnectedClientIds;
var connectedClientIds = LocalNetworkManager.ConnectionManager.ConnectedClientIds;
if (connectedClientIds.Count <= (IsHost ? 2 : 1))
{
return;
Expand Down Expand Up @@ -1605,7 +1605,7 @@ private void SendServerAnimStateRpc(AnimationMessage animationMessage, RpcParams
UpdateAnimationState(animationState);
}

var connectedClientIds = m_LocalNetworkManager.ConnectionManager.ConnectedClientIds;
var connectedClientIds = LocalNetworkManager.ConnectionManager.ConnectedClientIds;
if (connectedClientIds.Count <= (IsHost ? 2 : 1))
{
return;
Expand Down Expand Up @@ -1652,7 +1652,7 @@ private void ProcessAnimStates(AnimationMessage animationMessage)
{
if (HasAuthority)
{
if (m_LocalNetworkManager.LogLevel == LogLevel.Developer)
if (LocalNetworkManager.LogLevel == LogLevel.Developer)
{
var hostOrOwner = DistributedAuthorityMode ? "Owner" : "Host";
var clientServerOrDAMode = DistributedAuthorityMode ? "distributed authority" : "client-server";
Expand All @@ -1677,7 +1677,7 @@ internal void SendServerAnimTriggerRpc(AnimationTriggerMessage animationTriggerM
// Ignore if a non-owner sent this.
if (rpcParams.Receive.SenderClientId != OwnerClientId)
{
if (m_LocalNetworkManager.LogLevel == LogLevel.Developer)
if (LocalNetworkManager.LogLevel == LogLevel.Developer)
{
NetworkLog.LogWarning($"[Owner Authoritative] Detected the a non-authoritative client is sending the server animation trigger updates. If you recently changed ownership of the {name} object, then this could be the reason.");
}
Expand All @@ -1687,7 +1687,7 @@ internal void SendServerAnimTriggerRpc(AnimationTriggerMessage animationTriggerM
// set the trigger locally on the server
InternalSetTrigger(animationTriggerMessage.Hash, animationTriggerMessage.IsTriggerSet);

var connectedClientIds = m_LocalNetworkManager.ConnectionManager.ConnectedClientIds;
var connectedClientIds = LocalNetworkManager.ConnectionManager.ConnectedClientIds;

m_TargetGroup.Clear();
foreach (var clientId in connectedClientIds)
Expand Down