Kuizo Documentation
  • Getting Started
    • What is Kuizo?
    • Requirements
    • Installation Instructions
    • Quickstart
  • Using Kuizo
    • Creating and Setting up a new Kuizo Global Settings Object
    • Creating and Managing Categories
    • Creating and Managing Questions
  • Creating and Managing Quizzes
  • Game Settings
    • Configuring the Number of Questions
    • Configuring the Time Limit
    • Configuring the Number of Players
  • Information
    • Contact Me
    • Credits
Powered by GitBook
On this page
  1. Game Settings

Configuring the Number of Questions

PreviousCreating and Managing QuizzesNextConfiguring the Time Limit

Last updated 1 month ago

This setting defines how many questions will be asked during a game session.


How to change the available Number of Questions setting

This tutorial requires modifying scripts.

  1. In the Project window, navigate to KamelMahjoub/Kuizo/Scripts/Game Settings.

  2. Locate and open the script named NumberOfQuestions.

  3. Inside the NumberOfQuestions enum, add, remove or comment out values to define the number of questions you want your game to support.

    • For example, to make your game support up to 40 questions, modify the enum like this:

    public enum NumberOfQuestions
    {
        Five,
        Ten,
        Fifteen,
        Twenty, 
        TwentyFive,
        Thirty,
        ThirtyFive,
        Forty
    }
  1. Save the script.

  2. Next, locate and open the script named NumberOfQuestionsSetting.

  3. Inside the NumberOfPlayersSetting script, locate the method named UpdateOptionText().

  4. Add, remove, or comment out any switch cases to match the values defined in your modified enum.

    • For example, if your NumberOfQuestions enum now supports up to 40 questions, update the method like this:

private void UpdateOptionText()
        {
            optionText.text = selectedOption switch
            {
                NumberOfQuestions.Five => "5",
                NumberOfQuestions.Ten => "10",
                NumberOfQuestions.Fifteen => "15",
                NumberOfQuestions.Twenty => "20",
                NumberOfQuestions.TwentyFive => "25",
                NumberOfQuestions.Thirty => "30",
                NumberOfQuestions.ThirtyFive => "35",
                NumberOfQuestions.Forty => "40",
                _ => "Unknown Number Of Questions"
            };
        }
  1. Save the script.

  2. Locate and open the script named GameSettings.

  3. Inside the GameSettings script, locate the method named GetNumberOfQuestions().

  4. Add, remove, or comment out any switch cases to match the values defined in your modified enum.

    • For example, if your NumberOfQuestions enum now supports up to 40 questions, update the method like this:

public int GetNumberOfQuestions()
        {
            switch (selectedNumberOfQuestions)
            {
                case NumberOfQuestions.Five:
                    return 5;
                case NumberOfQuestions.Ten:
                    return 10;
                case NumberOfQuestions.Fifteen:
                    return 15;
                case NumberOfQuestions.Twenty:
                    return 20;
                case NumberOfQuestions.TwentyFive:
                    return 25;
                case NumberOfQuestions.Thirty:
                    return 30;
                case NumberOfQuestions.ThirtyFive:
                    return 35;
                case NumberOfQuestions.Forty:
                    return 40;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
  1. Save the script.

  2. Return to Unity and let it recompile the changes.