In my program I am trying to create buttons from an arraylist; however, I can’t seem to get it working. The button is displayed with the correct name whenever I add something to the arraylist useroptions, but whenever I click on the button the action that I define in the curly braces is not triggered. I have the following code in my OnGUI function:
foreach (string s in userOptions)
{
Debug.Log(s);
if (GUI.Button(new Rect(100, 100, 300, 300), s))
{
Debug.Log ("HERE");
npcConversation.reponseText = s;
}
}