I am using the Quiz Master to help me with my Scuba Refresher course. The online materials generally have 4 answers for the multiple choice questions, but some have 3 or only 2. So I have made some simple modifications to two of the scripts that allows for this.
I also had to make my buttons fit the entire width within the lines on the background, because some of the answers were trying to be multiple lines with the narrower button width. Since the buttons fill the area, if you have less of them they get taller, but it still looks pretty good.
In QuestionSO.cs I changed how answers was declared and added a public method:
[SerializeField]
string[] answers; // Number of elements is set in Unity Editor when this is initialized
/***
* GetNumberOfAnswers returns the number of answers in the answers array. This is set in the Unity Edtior.
***/
public int GetNumberOfAnswers()
{
return answers.Length;
} // GetNumberOfAnswers()
Then you simply change for loop in DisplayQuestion() for Quix.cs to enable buttons in use and disable buttons that are not used:
for (int i = 0; i < answerButtons.Length; i++)
{ // Change the text for all the buttons
TextMeshProUGUI buttonText;
if (i < currentQuestion.GetNumberOfAnswers())
{ // We have an answer to show for this button
answerButtons[i].SetActive(true);
buttonText = answerButtons[i].GetComponentInChildren<TextMeshProUGUI>();
buttonText.text = currentQuestion.GetAnswer(i);
} // if
else
{ // There is no answer for this button, so disable it to prevent it from showing or being clickable
answerButtons[i].SetActive(false);
} // else
} // for
I think this makes it a bit more flexible in allowing for varied numbers of answers to different questions. This will be a great way for me to create something like a Flash Card quiz configuration.
The PADI material is broken into sections, so an additional enhancement might be to have a way to group different sets of questions and allow you to either repeat the section just completed or go on to the next section. I think that could be done by creating a SectionSO.cs, like QuestionSO.cs, for each section that would be used for the End Screen Canvas. I am just not sure how you could use LoadScene for that to tell it how to reload a specific section. Might require a Soliton class to tell it which section to start with and you have a list of SectionSO objects which each has a list of QuestionSO objects.
Would be interested in feedback on that idea.