internal static void HandleConnectionApproved(uint clientId, BitReader reader, int channelId)
        {
            netManager.myClientId = reader.ReadUInt();
            uint sceneIndex = 0;

            if (netManager.NetworkConfig.EnableSceneSwitching)
            {
                sceneIndex = reader.ReadUInt();
            }

#if !DISABLE_CRYPTOGRAPHY
            if (netManager.NetworkConfig.EnableEncryption)
            {
                byte[] serverPublicKey = reader.ReadByteArray();
                netManager.clientAesKey = netManager.clientDiffieHellman.GetSharedSecret(serverPublicKey);
                if (netManager.NetworkConfig.SignKeyExchange)
                {
                    byte[] publicKeySignature = reader.ReadByteArray();
                    using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
                    {
                        rsa.PersistKeyInCsp = false;
                        rsa.FromXmlString(netManager.NetworkConfig.RSAPublicKey);
                        if (!rsa.VerifyData(serverPublicKey, new SHA512CryptoServiceProvider(), publicKeySignature))
                        {
                            //Man in the middle.
                            if (LogHelper.CurrentLogLevel <= LogLevel.Normal)
                            {
                                if (LogHelper.CurrentLogLevel <= LogLevel.Normal)
                                {
                                    LogHelper.LogWarning("Signature doesnt match for the key exchange public part. Disconnecting");
                                }
                            }
                            netManager.StopClient();
                            return;
                        }
                    }
                }
            }
#endif

            float netTime     = reader.ReadFloat();
            int   remoteStamp = reader.ReadInt();
            byte  error;
            int   msDelay = NetworkingManager.singleton.NetworkConfig.NetworkTransport.GetRemoteDelayTimeMS(clientId, remoteStamp, out error);
            netManager.networkTime = netTime + (msDelay / 1000f);

            netManager.connectedClients.Add(netManager.MyClientId, new NetworkedClient()
            {
                ClientId = netManager.MyClientId
            });
            int clientCount = reader.ReadInt();
            for (int i = 0; i < clientCount; i++)
            {
                uint _clientId = reader.ReadUInt();
                netManager.connectedClients.Add(_clientId, new NetworkedClient()
                {
                    ClientId = _clientId
                });
                netManager.connectedClientsList.Add(netManager.connectedClients[_clientId]);
            }
            if (netManager.NetworkConfig.HandleObjectSpawning)
            {
                SpawnManager.DestroySceneObjects();
                int objectCount = reader.ReadInt();
                for (int i = 0; i < objectCount; i++)
                {
                    bool isPlayerObject = reader.ReadBool();
                    uint networkId      = reader.ReadUInt();
                    uint ownerId        = reader.ReadUInt();
                    int  prefabId       = reader.ReadInt();
                    bool isActive       = reader.ReadBool();
                    bool sceneObject    = reader.ReadBool();
                    bool visible        = reader.ReadBool();

                    float xPos = reader.ReadFloat();
                    float yPos = reader.ReadFloat();
                    float zPos = reader.ReadFloat();

                    float xRot = reader.ReadFloat();
                    float yRot = reader.ReadFloat();
                    float zRot = reader.ReadFloat();

                    NetworkedObject netObject = SpawnManager.CreateSpawnedObject(prefabId, networkId, ownerId, isPlayerObject,
                                                                                 new Vector3(xPos, yPos, zPos), Quaternion.Euler(xRot, yRot, zRot), reader, visible, false);
                    netObject.SetLocalVisibility(visible);
                    netObject.sceneObject = sceneObject;
                    netObject.gameObject.SetActive(isActive);
                }
            }

            if (netManager.NetworkConfig.EnableSceneSwitching)
            {
                NetworkSceneManager.OnSceneSwitch(sceneIndex);
            }

            netManager._isClientConnected = true;
            if (netManager.OnClientConnectedCallback != null)
            {
                netManager.OnClientConnectedCallback.Invoke(netManager.MyClientId);
            }
        }
        internal static void HandleDestroyObject(uint clientId, BitReader reader, int channelId)
        {
            uint netId = reader.ReadUInt();

            SpawnManager.OnDestroyObject(netId, true);
        }