the Q and A are separate strings that are members of the same array.
we are basically making our own data structure in the first four lines with a type we called “Item”
class Item {
var question : String;
var answer : String;
}
then creating an array of them…
var questions : Item [];
note: in “Item”, you could have any amount of variables which could be strings, floats, booleans, gameObjects, or whatever
copy and paste that simple script i wrote save it, place an empty gameobject into the hierarchy and attach the script you saved to it . when you look in the inspector you should see your variables and be able to edit them. set the size of the array to the amount of questions you want to ask and enter the data in the boxes that pop up which represent the Q and A… the actual data does not need to be hard coded into the script
after entering that data, run your game… nothing spectacular will happen onscreen, but in the console window it will print out all the data you entered in the inspector.
in the script I wrote, questions
represents the entire array which holds the Q and A.
questions[questionNumber].question
represents your question and
questions[questionNumber].answer
represents your corresponding answer
Yes, you should be able to use the GUI stuff; however, I haven’t used it enough to suggest exactly how to do it
You should be able to do multiple answers with this method, you will just have to add additional members to the “Item” we created or make “answer” in “Item” an array of Strings instead of a single String.[/code]