Skip to content

Commit db2315c

Browse files
fix
Minor NetworkTransform fix to prevent error logging of messages received by a previous owner. If NetworkTransform is not active then don't check for updates during the tick update.
1 parent b449ea8 commit db2315c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,12 @@ private bool CheckForStateChange(ref NetworkTransformState networkState, ref Tra
20772077
/// </summary>
20782078
private void OnNetworkTick()
20792079
{
2080+
// If not active, then ignore the update
2081+
if (!gameObject.activeInHierarchy)
2082+
{
2083+
return;
2084+
}
2085+
20802086
// As long as we are still authority
20812087
if (CanCommitToTransform)
20822088
{
@@ -3369,7 +3375,9 @@ internal void TransformStateUpdate(ref NetworkTransformState networkTransformSta
33693375
{
33703376
if (CanCommitToTransform)
33713377
{
3372-
Debug.LogError($"Authority receiving transform update from Client-{senderId}!");
3378+
// TODO: Investigate where this state should be applied or just discarded.
3379+
// For now, discard the state if we assumed ownership.
3380+
return;
33733381
}
33743382
// Store the previous/old state
33753383
m_OldState = m_LocalAuthoritativeNetworkState;

0 commit comments

Comments
 (0)