Пример #1
0
 public void OnConnected(UnityEngine.Networking.NetworkMessage netMsg)
 {
     Debug.Log("Connected to server");
     nickname = GameObject.Find("NameInputField/Text").GetComponent <Text>().text;
     SceneManager.LoadScene("lobbyScene");
     myClient.Send(1337, new NetworkMessageBase(JsonUtility.ToJson(new NetworkInstanceVars("name", nickname))));
 }
Пример #2
0
        private void FireOnUnityMessageReceived(UnityEngine.Networking.NetworkMessage netMsg)
        {
            NetworkMessage message = netMsg.ReadMessage <NetworkMessage>();
            Packet         packet  = message.Data.ToPacket();

            if (packet.Type != PacketType.None)
            {
                byte[] bytes = this.Append(packet);

                if (bytes != null)
                {
                    FireOnMessageReceivedSuccess(this, bytes);
                    if (_messages.Count > 0)
                    {
                        ProcessSend(_messages.Dequeue());
                    }
                }
                else
                {
                    this.Send(new Packet(
                                  PacketType.None, new byte[] { 0 }));
                }
            }
            else
            {
                this.Send(this.PopPacket());
            }
        }
Пример #3
0
        private void FireOnUnityError(UnityEngine.Networking.NetworkMessage netMsg)
        {
            ErrorMessage error = netMsg.ReadMessage <ErrorMessage>();

            DebugHelper.PrintError(
                new NetworkInfoException("Error:" + error.errorCode));
        }
Пример #4
0
    public void OnClientMessage(UnityEngine.Networking.NetworkMessage netMsg)
    {
        NetworkInstanceVars json = JsonUtility.FromJson <NetworkInstanceVars>(netMsg.reader.ReadString());

        switch (json.messageType)
        {
        case "winner":
            Debug.Log("Server Message type: winner: " + serverPlayerList[netMsg.conn.address]);
            int objective = Random.Range(0, objectiveCount - 1);
            sendWinnerMessageToClient(netMsg.conn.address, objective);

            //Next round, update scores
            serverScoreList[netMsg.conn.address]++;
            Debug.Log("Scoreboard");
            foreach (KeyValuePair <string, int> score in serverScoreList)
            {
                Debug.Log(score.Key + ": " + score.Value + "point(s)");
            }

            round++;
            if (round > roundLimit)
            {
                //Game end message to clients
                Debug.Log("game end");
                sendEndMessageToClient();
            }
            Debug.Log(scoreboardToString(serverScoreList));
            Debug.Log("Round end: " + round + "/" + roundLimit);
            break;

        case "name":
            Debug.Log("Server Message type: name: " + json.name);
            serverPlayerList[netMsg.conn.address] = json.name;
            if (!clientManager.getClientPlayerList().Contains(json.name))
            {
                clientManager.addToClientPlayerList(json.name);
            }
            syncPlayerLists();
            break;

        default:
            Debug.Log("unknown message from client type: " + json.messageType);
            break;
        }
    }
Пример #5
0
    public void OnServerMessage(UnityEngine.Networking.NetworkMessage netMsg)
    {
        NetworkInstanceVars json = JsonUtility.FromJson <NetworkInstanceVars>(netMsg.reader.ReadString());

        switch (json.messageType)
        {
        case "start":
            Debug.Log("Client Message type: start");
            SceneManager.LoadScene("mainScene");
            objective = json.objective;
            round.startRound(objective);
            break;

        case "player list":
            Debug.Log("Client Message type: player list");
            clientPlayerList = new List <string>(json.playerListName);
            uiManager.updatePlayerListUI(clientPlayerList);
            break;

        case "winner":
            Debug.Log("Client Message type: winner: " + json.name);

            //winner panel show subroutine
            StartCoroutine(uiManager.showWinnerPanel(json.name));
            StartCoroutine(round.disableSelection());
            objective = json.objective;
            round.startRound(objective);
            Debug.Log("objective: " + objective);
            break;

        case "end":
            Debug.Log("game end");
            SceneManager.LoadScene("VictoryScene");
            uiManager.setVictoryMessage(json.name);
            break;

        default:
            Debug.Log("unknown message from server type: " + json.messageType);
            break;
        }
    }
Пример #6
0
 public void OnConnected(NetworkMessage msg)
 {
     Debug.Log("Connected!");
 }
Пример #7
0
 private static void OnObjectSpawn(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <ObjectSpawnMessage>(ClientScene.s_ObjectSpawnMessage);
     if (!ClientScene.s_ObjectSpawnMessage.assetId.IsValid())
     {
         if (LogFilter.logError)
         {
             Debug.LogError("OnObjSpawn netId: " + ClientScene.s_ObjectSpawnMessage.netId + " has invalid asset Id");
         }
     }
     else
     {
         if (LogFilter.logDebug)
         {
             Debug.Log(string.Concat(new object[]
             {
                 "Client spawn handler instantiating [netId:",
                 ClientScene.s_ObjectSpawnMessage.netId,
                 " asset ID:",
                 ClientScene.s_ObjectSpawnMessage.assetId,
                 " pos:",
                 ClientScene.s_ObjectSpawnMessage.position,
                 "]"
             }));
         }
         NetworkIdentity component;
         GameObject      original;
         SpawnDelegate   spawnDelegate;
         if (ClientScene.s_NetworkScene.GetNetworkIdentity(ClientScene.s_ObjectSpawnMessage.netId, out component))
         {
             ClientScene.ApplySpawnPayload(component, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.payload, ClientScene.s_ObjectSpawnMessage.netId, null);
         }
         else if (NetworkScene.GetPrefab(ClientScene.s_ObjectSpawnMessage.assetId, out original))
         {
             GameObject gameObject = Object.Instantiate <GameObject>(original, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.rotation);
             if (LogFilter.logDebug)
             {
                 Debug.Log(string.Concat(new object[]
                 {
                     "Client spawn handler instantiating [netId:",
                     ClientScene.s_ObjectSpawnMessage.netId,
                     " asset ID:",
                     ClientScene.s_ObjectSpawnMessage.assetId,
                     " pos:",
                     ClientScene.s_ObjectSpawnMessage.position,
                     " rotation: ",
                     ClientScene.s_ObjectSpawnMessage.rotation,
                     "]"
                 }));
             }
             component = gameObject.GetComponent <NetworkIdentity>();
             if (component == null)
             {
                 if (LogFilter.logError)
                 {
                     Debug.LogError("Client object spawned for " + ClientScene.s_ObjectSpawnMessage.assetId + " does not have a NetworkIdentity");
                 }
             }
             else
             {
                 component.Reset();
                 ClientScene.ApplySpawnPayload(component, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.payload, ClientScene.s_ObjectSpawnMessage.netId, gameObject);
             }
         }
         else if (NetworkScene.GetSpawnHandler(ClientScene.s_ObjectSpawnMessage.assetId, out spawnDelegate))
         {
             GameObject gameObject2 = spawnDelegate(ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.assetId);
             if (gameObject2 == null)
             {
                 if (LogFilter.logWarn)
                 {
                     Debug.LogWarning("Client spawn handler for " + ClientScene.s_ObjectSpawnMessage.assetId + " returned null");
                 }
             }
             else
             {
                 component = gameObject2.GetComponent <NetworkIdentity>();
                 if (component == null)
                 {
                     if (LogFilter.logError)
                     {
                         Debug.LogError("Client object spawned for " + ClientScene.s_ObjectSpawnMessage.assetId + " does not have a network identity");
                     }
                 }
                 else
                 {
                     component.Reset();
                     component.SetDynamicAssetId(ClientScene.s_ObjectSpawnMessage.assetId);
                     ClientScene.ApplySpawnPayload(component, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.payload, ClientScene.s_ObjectSpawnMessage.netId, gameObject2);
                 }
             }
         }
         else if (LogFilter.logError)
         {
             Debug.LogError(string.Concat(new object[]
             {
                 "Failed to spawn server object, did you forget to add it to the NetworkManager? assetId=",
                 ClientScene.s_ObjectSpawnMessage.assetId,
                 " netId=",
                 ClientScene.s_ObjectSpawnMessage.netId
             }));
         }
     }
 }
Пример #8
0
    private void __onMove(UnityEngine.Networking.NetworkMessage netMsg)
    {
        Message.Move move = netMsg.ReadMessage <Message.Move>();

        GetPlayerObj(move.playerId).transform.Translate(move.direction * move.speed);
    }
Пример #9
0
 private void OnCRC(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <CRCMessage>(NetworkClient.s_CRCMessage);
     NetworkCRC.Validate(NetworkClient.s_CRCMessage.scripts, this.numChannels);
 }
 void OnCRC(NetworkMessage netMsg)
 {
     netMsg.ReadMessage(s_CRCMessage);
     NetworkCRC.Validate(s_CRCMessage.scripts, numChannels);
 }
        static void OnSpawnPrefab(NetworkMessage netMsg)
        {
            SpawnPrefabMessage msg = new SpawnPrefabMessage();

            netMsg.ReadMessage(msg);

            if (!msg.assetId.IsValid())
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("OnObjSpawn netId: " + msg.netId + " has invalid asset Id");
                }
                return;
            }
            if (LogFilter.logDebug)
            {
                Debug.Log("Client spawn handler instantiating [netId:" + msg.netId + " asset ID:" + msg.assetId + " pos:" + msg.position + "]");
            }

#if UNITY_EDITOR
            UnityEditor.NetworkDetailStats.IncrementStat(
                UnityEditor.NetworkDetailStats.NetworkDirection.Incoming,
                (short)MsgType.SpawnPrefab, GetStringForAssetId(msg.assetId), 1);
#endif

            NetworkIdentity localNetworkIdentity;
            if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity))
            {
                // this object already exists (was in the scene), just apply the update to existing object
                localNetworkIdentity.Reset();
                ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, null);
                return;
            }

            GameObject    prefab;
            SpawnDelegate handler;
            if (NetworkScene.GetPrefab(msg.assetId, out prefab))
            {
                var obj = (GameObject)Object.Instantiate(prefab, msg.position, msg.rotation);
                if (LogFilter.logDebug)
                {
                    Debug.Log("Client spawn handler instantiating [netId:" + msg.netId + " asset ID:" + msg.assetId + " pos:" + msg.position + " rotation: " + msg.rotation + "]");
                }

                localNetworkIdentity = obj.GetComponent <NetworkIdentity>();
                if (localNetworkIdentity == null)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("Client object spawned for " + msg.assetId + " does not have a NetworkIdentity");
                    }
                    return;
                }
                localNetworkIdentity.Reset();
                ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, obj);
            }
            // lookup registered factory for type:
            else if (NetworkScene.GetSpawnHandler(msg.assetId, out handler))
            {
                GameObject obj = handler(msg.position, msg.assetId);
                if (obj == null)
                {
                    if (LogFilter.logWarn)
                    {
                        Debug.LogWarning("Client spawn handler for " + msg.assetId + " returned null");
                    }
                    return;
                }
                localNetworkIdentity = obj.GetComponent <NetworkIdentity>();
                if (localNetworkIdentity == null)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("Client object spawned for " + msg.assetId + " does not have a network identity");
                    }
                    return;
                }
                localNetworkIdentity.Reset();
                localNetworkIdentity.SetDynamicAssetId(msg.assetId);
                ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, obj);
            }
            else
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("Failed to spawn server object, did you forget to add it to the NetworkManager? assetId=" + msg.assetId + " netId=" + msg.netId);
                }
            }
        }
Пример #12
0
 public void OnServerConnected(UnityEngine.Networking.NetworkMessage netMsg)
 {
     Debug.Log("server: client connected");
     serverPlayerList[netMsg.conn.address] = null;
 }
Пример #13
0
 private static void OnObjectSpawn(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <ObjectSpawnMessage>(s_ObjectSpawnMessage);
     if (!s_ObjectSpawnMessage.assetId.IsValid())
     {
         if (LogFilter.logError)
         {
             Debug.LogError("OnObjSpawn netId: " + s_ObjectSpawnMessage.netId + " has invalid asset Id");
         }
     }
     else
     {
         NetworkIdentity component;
         if (LogFilter.logDebug)
         {
             Debug.Log(string.Concat(new object[] { "Client spawn handler instantiating [netId:", s_ObjectSpawnMessage.netId, " asset ID:", s_ObjectSpawnMessage.assetId, " pos:", s_ObjectSpawnMessage.position, "]" }));
         }
         NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Incoming, 3, GetStringForAssetId(s_ObjectSpawnMessage.assetId), 1);
         if (s_NetworkScene.GetNetworkIdentity(s_ObjectSpawnMessage.netId, out component))
         {
             ApplySpawnPayload(component, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, null);
         }
         else
         {
             GameObject obj2;
             if (NetworkScene.GetPrefab(s_ObjectSpawnMessage.assetId, out obj2))
             {
                 GameObject newGameObject = (GameObject)UnityEngine.Object.Instantiate(obj2, s_ObjectSpawnMessage.position, Quaternion.identity);
                 component = newGameObject.GetComponent <NetworkIdentity>();
                 if (component == null)
                 {
                     if (LogFilter.logError)
                     {
                         Debug.LogError("Client object spawned for " + s_ObjectSpawnMessage.assetId + " does not have a NetworkIdentity");
                     }
                 }
                 else
                 {
                     ApplySpawnPayload(component, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, newGameObject);
                 }
             }
             else
             {
                 SpawnDelegate delegate2;
                 if (NetworkScene.GetSpawnHandler(s_ObjectSpawnMessage.assetId, out delegate2))
                 {
                     GameObject obj4 = delegate2(s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.assetId);
                     if (obj4 == null)
                     {
                         if (LogFilter.logWarn)
                         {
                             Debug.LogWarning("Client spawn handler for " + s_ObjectSpawnMessage.assetId + " returned null");
                         }
                     }
                     else
                     {
                         component = obj4.GetComponent <NetworkIdentity>();
                         if (component == null)
                         {
                             if (LogFilter.logError)
                             {
                                 Debug.LogError("Client object spawned for " + s_ObjectSpawnMessage.assetId + " does not have a network identity");
                             }
                         }
                         else
                         {
                             component.SetDynamicAssetId(s_ObjectSpawnMessage.assetId);
                             ApplySpawnPayload(component, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, obj4);
                         }
                     }
                 }
                 else if (LogFilter.logError)
                 {
                     Debug.LogError(string.Concat(new object[] { "Failed to spawn server object, assetId=", s_ObjectSpawnMessage.assetId, " netId=", s_ObjectSpawnMessage.netId }));
                 }
             }
         }
     }
 }
Пример #14
0
 private void FireOnUnityDisconnected(UnityEngine.Networking.NetworkMessage netMsg)
 {
     FireOnDisconnected(this);
 }
Пример #15
0
 internal static void OnFragment(NetworkMessage netMsg)
 {
     netMsg.conn.HandleFragment(netMsg.reader, netMsg.channelId);
 }
Пример #16
0
        private static void OnObjectSpawn(NetworkMessage netMsg)
        {
            netMsg.ReadMessage(s_ObjectSpawnMessage);
            if (!s_ObjectSpawnMessage.assetId.IsValid())
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("OnObjSpawn netId: " + s_ObjectSpawnMessage.netId + " has invalid asset Id");
                }
                return;
            }
            if (LogFilter.logDebug)
            {
                Debug.Log("Client spawn handler instantiating [netId:" + s_ObjectSpawnMessage.netId + " asset ID:" + s_ObjectSpawnMessage.assetId + " pos:" + s_ObjectSpawnMessage.position + "]");
            }
            GameObject    prefab;
            SpawnDelegate handler;

            if (s_NetworkScene.GetNetworkIdentity(s_ObjectSpawnMessage.netId, out NetworkIdentity uv))
            {
                ApplySpawnPayload(uv, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, null);
            }
            else if (NetworkScene.GetPrefab(s_ObjectSpawnMessage.assetId, out prefab))
            {
                GameObject gameObject = Object.Instantiate(prefab, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.rotation);
                if (LogFilter.logDebug)
                {
                    Debug.Log("Client spawn handler instantiating [netId:" + s_ObjectSpawnMessage.netId + " asset ID:" + s_ObjectSpawnMessage.assetId + " pos:" + s_ObjectSpawnMessage.position + " rotation: " + s_ObjectSpawnMessage.rotation + "]");
                }
                uv = gameObject.GetComponent <NetworkIdentity>();
                if (uv == null)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("Client object spawned for " + s_ObjectSpawnMessage.assetId + " does not have a NetworkIdentity");
                    }
                }
                else
                {
                    uv.Reset();
                    ApplySpawnPayload(uv, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, gameObject);
                }
            }
            else if (NetworkScene.GetSpawnHandler(s_ObjectSpawnMessage.assetId, out handler))
            {
                GameObject gameObject2 = handler(s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.assetId);
                if (gameObject2 == null)
                {
                    if (LogFilter.logWarn)
                    {
                        Debug.LogWarning("Client spawn handler for " + s_ObjectSpawnMessage.assetId + " returned null");
                    }
                    return;
                }
                uv = gameObject2.GetComponent <NetworkIdentity>();
                if (uv == null)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("Client object spawned for " + s_ObjectSpawnMessage.assetId + " does not have a network identity");
                    }
                }
                else
                {
                    uv.Reset();
                    uv.SetDynamicAssetId(s_ObjectSpawnMessage.assetId);
                    ApplySpawnPayload(uv, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, gameObject2);
                }
            }
            else if (LogFilter.logError)
            {
                Debug.LogError("Failed to spawn server object, did you forget to add it to the NetworkManager? assetId=" + s_ObjectSpawnMessage.assetId + " netId=" + s_ObjectSpawnMessage.netId);
            }
        }
Пример #17
0
 private static void OnObjectSpawn(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <ObjectSpawnMessage>(ClientScene.s_ObjectSpawnMessage);
     if (!ClientScene.s_ObjectSpawnMessage.assetId.IsValid())
     {
         if (!LogFilter.logError)
         {
             return;
         }
         Debug.LogError((object)("OnObjSpawn netId: " + (object)ClientScene.s_ObjectSpawnMessage.netId + " has invalid asset Id"));
     }
     else
     {
         if (LogFilter.logDebug)
         {
             Debug.Log((object)("Client spawn handler instantiating [netId:" + (object)ClientScene.s_ObjectSpawnMessage.netId + " asset ID:" + (object)ClientScene.s_ObjectSpawnMessage.assetId + " pos:" + (object)ClientScene.s_ObjectSpawnMessage.position + "]"));
         }
         NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Incoming, (short)3, ClientScene.GetStringForAssetId(ClientScene.s_ObjectSpawnMessage.assetId), 1);
         NetworkIdentity uv;
         if (ClientScene.s_NetworkScene.GetNetworkIdentity(ClientScene.s_ObjectSpawnMessage.netId, out uv))
         {
             ClientScene.ApplySpawnPayload(uv, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.payload, ClientScene.s_ObjectSpawnMessage.netId, (GameObject)null);
         }
         else
         {
             GameObject prefab;
             if (NetworkScene.GetPrefab(ClientScene.s_ObjectSpawnMessage.assetId, out prefab))
             {
                 GameObject newGameObject = (GameObject)Object.Instantiate((Object)prefab, ClientScene.s_ObjectSpawnMessage.position, Quaternion.identity);
                 uv = newGameObject.GetComponent <NetworkIdentity>();
                 if ((Object)uv == (Object)null)
                 {
                     if (!LogFilter.logError)
                     {
                         return;
                     }
                     Debug.LogError((object)("Client object spawned for " + (object)ClientScene.s_ObjectSpawnMessage.assetId + " does not have a NetworkIdentity"));
                 }
                 else
                 {
                     ClientScene.ApplySpawnPayload(uv, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.payload, ClientScene.s_ObjectSpawnMessage.netId, newGameObject);
                 }
             }
             else
             {
                 SpawnDelegate handler;
                 if (NetworkScene.GetSpawnHandler(ClientScene.s_ObjectSpawnMessage.assetId, out handler))
                 {
                     GameObject newGameObject = handler(ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.assetId);
                     if ((Object)newGameObject == (Object)null)
                     {
                         if (!LogFilter.logWarn)
                         {
                             return;
                         }
                         Debug.LogWarning((object)("Client spawn handler for " + (object)ClientScene.s_ObjectSpawnMessage.assetId + " returned null"));
                     }
                     else
                     {
                         uv = newGameObject.GetComponent <NetworkIdentity>();
                         if ((Object)uv == (Object)null)
                         {
                             if (!LogFilter.logError)
                             {
                                 return;
                             }
                             Debug.LogError((object)("Client object spawned for " + (object)ClientScene.s_ObjectSpawnMessage.assetId + " does not have a network identity"));
                         }
                         else
                         {
                             uv.SetDynamicAssetId(ClientScene.s_ObjectSpawnMessage.assetId);
                             ClientScene.ApplySpawnPayload(uv, ClientScene.s_ObjectSpawnMessage.position, ClientScene.s_ObjectSpawnMessage.payload, ClientScene.s_ObjectSpawnMessage.netId, newGameObject);
                         }
                     }
                 }
                 else
                 {
                     if (!LogFilter.logError)
                     {
                         return;
                     }
                     Debug.LogError((object)("Failed to spawn server object, assetId=" + (object)ClientScene.s_ObjectSpawnMessage.assetId + " netId=" + (object)ClientScene.s_ObjectSpawnMessage.netId));
                 }
             }
         }
     }
 }
Пример #18
0
 /// <summary>
 /// Sendet die Matchdaten an den Client, der die Anfrage gesendet hat.
 /// </summary>
 /// <param name="netMsg">Netzwerknachricht als Anfrage.</param>
 public void SendMeMatchData(UnityEngine.Networking.NetworkMessage netMsg)
 {
     netMsg.conn.Send(4545, matchData.GetMyData(netMsg.conn.connectionId));
 }
Пример #19
0
        public static void HandleTransform(NetworkMessage netMsg)
        {
            NetworkInstanceId networkInstanceId = netMsg.reader.ReadNetworkId();
            GameObject        gameObject        = NetworkServer.FindLocalObject(networkInstanceId);

            if (gameObject == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("HandleTransform no gameObject");
                }
                return;
            }
            NetworkTransform component = gameObject.GetComponent <NetworkTransform>();

            if (component == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("HandleTransform null target");
                }
            }
            else if (!component.localPlayerAuthority)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("HandleTransform no localPlayerAuthority");
                }
            }
            else if (netMsg.conn.clientOwnedObjects == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("HandleTransform object not owned by connection");
                }
            }
            else if (netMsg.conn.clientOwnedObjects.Contains(networkInstanceId))
            {
                switch (component.transformSyncMode)
                {
                case TransformSyncMode.SyncNone:
                    return;

                case TransformSyncMode.SyncTransform:
                    component.UnserializeModeTransform(netMsg.reader, initialState: false);
                    break;

                case TransformSyncMode.SyncRigidbody3D:
                    component.UnserializeMode3D(netMsg.reader, initialState: false);
                    break;

                case TransformSyncMode.SyncRigidbody2D:
                    component.UnserializeMode2D(netMsg.reader, initialState: false);
                    break;

                case TransformSyncMode.SyncCharacterController:
                    component.UnserializeModeCharacterController(netMsg.reader, initialState: false);
                    break;
                }
                component.m_LastClientSyncTime = Time.time;
            }
            else if (LogFilter.logWarn)
            {
                Debug.LogWarning("HandleTransform netId:" + networkInstanceId + " is not for a valid player");
            }
        }