I am creating this quiz app and I’m having a little bit of trouble in storing the data and loading/displaying it afterwards. I will try to be as detailed as much as I can in explain my questions.
It’s supposed to be this way
- five text fields
- 1 for question
- 4 for choices
- after user clicks save
- the question will be stored in an
array - new questions will be stored in the
same array as the old questions
The way I structured the question and answers are like this:
- Quiz is their parent
- save button is not within quiz
I want to store/save the questions with its choices in an array so i can load them for future use.
EXTRA QUESTION:
Is there a way that I can randomize the order for the answers(when displayed)
For example inputs are
- What is 2+2
- 1
- 2
- 3
- 4
Then it will display
- What is 2+2
- 3
- 2
- 4
- 1
[EDIT]
Below is the class that accepts the user input for the question.
public class NewQuestion{
public static void getQuestion(string newQuestion)
{
Debug.Log("input" + newQuestion);
string question = newQuestion;
}
}
Below is one of the classes that accepts the input for the answers.
public class choiceA : MonoBehaviour
{
public void getAnswerA(string A)
{
Debug.Log("input" + A);
string optionA = A;
}
}
Below is the class where I am trying to call all the inputs when I click a save button.
[System.Serializable]
public class OnClickSave : MonoBehaviour
{
public string question;
public string optionA;
public string optionB;
public string optionC;
public string optionD;
public ArrayList[] items;
}