protected virtual void showMessage(int index) { dialogueWindow.setText(this.messages[index].Message); var options = this.messages[index].Options; for (var i = 0; i < options.Count; i++) { var test = i; var response = options[test].Response; Button option = dialogueWindow.setOption(options[i].Option); if (response < 0) { option.onClick.AddListener(delegate(){ dialogueWindow.show(false); }); } else { option.onClick.AddListener(delegate(){ this.showMessage(response); }); } } dialogueWindow.show(true); }