private void ProcessMessage(string message) { StringReader sr = new StringReader(message); var toDo = sr.ReadLine(); switch (toDo) { case "DM": DM = JsonConvert.DeserializeObject <DungeonMaster>(sr.ReadToEnd()); DM.SetupEvents(); DM.data = GameData.CreateFromJson(TileJson.text, CharacterJson.text, ActionJson.text); Debug.Log("Loaded level from server"); LoadCombatScene(); break; case "Take action": var outcome = JsonConvert.DeserializeObject <Outcome>(sr.ReadToEnd()); DM.ApplyOutcome(outcome); break; default: Debug.LogError("Unknown action: " + toDo); break; } }