private void InitClient(tk.TcpClient client) { if (privateAPI) // private API client server { PrivateAPI privateAPIHandler = GameObject.FindObjectOfType <PrivateAPI>(); if (privateAPIHandler != null) { if (_server.debug) { Debug.Log("init private API handler."); } privateAPIHandler.Init(client.gameObject.GetComponent <tk.JsonTcpClient>()); } } else // normal client server { if (spawnCarswClients) // we are on in a track scene { CarSpawner spawner = GameObject.FindObjectOfType <CarSpawner>(); if (spawner != null) { if (_server.debug) { Debug.Log("spawning car."); } spawner.Spawn(client.gameObject.GetComponent <tk.JsonTcpClient>(), false); } } else //we are in the menu { tk.TcpMenuHandler handler = GameObject.FindObjectOfType <TcpMenuHandler>(); if (handler != null) { if (_server.debug) { Debug.Log("init menu handler."); } handler.Init(client.gameObject.GetComponent <tk.JsonTcpClient>()); } } } }