public void ParseMessage(string[] messages) { switch (messages[0]) { case "character": //they have selected a character GameObject options = GameObject.FindGameObjectWithTag("options"); if (options) { CharacterSelect select = options.GetComponent <CharacterSelect>(); int character = int.Parse(messages[1]); select.OtherPlayerSelected(character); } break; case "move": int x = int.Parse(messages[1]), y = int.Parse(messages[2]); Direction direction = ParseDirection(messages[3]); try { _core.MakeNetworkMove(x, y, direction); } catch (Exception e) { Debug.Log(e.Message); } break; case "emote": //call "OtherEmote" on player2's emotecontroller EmoteController player2Emotes = GameObject.FindGameObjectWithTag("Player2") .GetComponent <EmoteController>(); int emote = int.Parse(messages[1]); player2Emotes.OtherEmote(emote); break; case "checkconnection": Send("received"); break; case "received": _waitingForResponse = false; break; case "hello": if (isClient) { client.responseReceived = true; } else { Send("hello"); } break; } }