mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServer.OnCommandMessage: removed unnecessary GetComponent call and unnecessary .gameObject calls by using NetworkIdentity.spawned directly
This commit is contained in:
parent
42ab1be224
commit
6f5ee57248
@ -846,17 +846,11 @@ static void OnCommandMessage(NetworkMessage netMsg)
|
||||
{
|
||||
CommandMessage message = netMsg.ReadMessage<CommandMessage>();
|
||||
|
||||
var cmdObject = FindLocalObject(message.netId);
|
||||
if (cmdObject == null)
|
||||
{
|
||||
Debug.LogWarning("Instance not found when handling Command message [netId=" + message.netId + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkIdentity identity = cmdObject.GetComponent<NetworkIdentity>();
|
||||
NetworkIdentity identity;
|
||||
NetworkIdentity.spawned.TryGetValue(message.netId, out identity);
|
||||
if (identity == null)
|
||||
{
|
||||
Debug.LogWarning("NetworkIdentity deleted when handling Command message [netId=" + message.netId + "]");
|
||||
Debug.LogWarning("Spawned object not found when handling Command message [netId=" + message.netId + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user