//Client gets file content from server; public void OnResponseTerrain(NetworkConnection conn, TerraintDataMessage msg) { Debug.Log("Terrain Responded by server"); Debug.Log(msg.content); // conn.Disconnect(); }
//Server gets data from client and responds with file... public void OnRequestTerrain(NetworkConnection conn, TerraintDataMessage msg) { Debug.Log(msg.x); string data; Debug.Log("Terrain Requested by client"); if (File.Exists(NetworkManagerMMO.instance.streamPath + "10_10.json")) { Debug.Log("File Exists " + NetworkManagerMMO.instance.streamPath + "10_10.json"); using (StreamReader stream = new StreamReader(NetworkManagerMMO.instance.streamPath + "10_10.json")) { string json = stream.ReadToEnd(); Debug.Log(json); data = json; //JsonUtility.FromJson<string>(json); } TerraintDataMessage ResponseMessage = new TerraintDataMessage { content = data }; conn.Send(ResponseMessage); } }