Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ public bool Deserialize(FastBufferReader reader, ref NetworkContext context, int
return false;
}

// Get the target NetworkTransform
// Get the target NetworkTransform
var transform = networkObject.ChildNetworkBehaviours[networkBehaviourId] as NetworkTransform;
if (transform == null)
{
Debug.LogError($"[{nameof(NetworkTransformMessage)}][Invalid] Targeted {nameof(NetworkTransform)}, {nameof(NetworkBehaviour.NetworkBehaviourId)} ({networkBehaviourId}), does not exist! Make sure you are not spawning {nameof(NetworkObject)}s with disabled {nameof(GameObject)}s that have {nameof(NetworkBehaviour)} components on them.");
Debug.LogError(networkObject.gameObject.name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate that this fixes the issue of finding the name of the game object, however that name is being logged without any context. We prefer to ensure that our error logs have enough context to understand what the error message is trying to communicate.

A better fix would be to edit the log underneath and add the gameobject name into the existing log.

Debug.LogError($"[{nameof(NetworkTransformMessage)}][Invalid] Targeted {(NetworkTransform.gameObject)}, {nameof(NetworkBehaviour.NetworkBehaviourId)} ({networkBehaviourId}), does not exist! Make sure you are not spawning {nameof(NetworkObject)}s with disabled {nameof(GameObject)}s that have {nameof(NetworkBehaviour)} components on them.");
return false;
}

Expand Down