public override void onMessage(Message m) { base.onMessage(m); switch (m.type) { case MsgType.Dialogue: AddLine(m.from.entityName, m.data.ToString(), "white"); break; case MsgType.DialogueResponse: int i = 0; string[] responses = (string[])m.data; foreach (Button button in buttons) { button.gameObject.GetComponentInChildren <Text>().text = ""; Destroy(button.gameObject.GetComponent <DialogueOption>()); button.gameObject.SetActive(false); if (i < responses.Length) { button.gameObject.SetActive(true); DialogueOption newOption = button.gameObject.AddComponent <DialogueOption>(); DialogueOption data = dialogueOptions[responses[i]]; newOption.resultingIdentifiers = data.resultingIdentifiers; newOption.identifier = data.identifier; newOption.optionText = data.optionText; newOption.response = data.response; newOption.entityName = data.entityName; newOption.name = data.entityName; newOption.triggersQuest = data.triggersQuest; newOption.completesQuest = data.completesQuest; newOption.AssignButton(button); newOption.SetOption(); i++; } } break; } }