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 Time Limit

PreviousConfiguring the Number of QuestionsNextConfiguring the Number of Players

Last updated 1 month ago

This setting defines the available time for each player to answer questions during a game session.


How to change the available Time Limit 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 TimeLimit.

  3. Inside the TimeLimit enum, add, remove or comment out values to define the durations you want your game to support.

    • For example, to make your game support a time limit of 5 minutes , modify the enum like this:

    public enum TimeLimit 
    {
        FifteenSeconds,
        ThirtySeconds,
        FortyFiveSeconds,
        OneMinute,
        OneMinuteFifteenSeconds,
        OneMinuteThirtySeconds,
        OneMinuteFortyFiveSeconds,
        TwoMinutes,
        FiveMinutes,
        NoTimeLimit
    } 
  1. Save the script.

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

  3. Inside the TimeLimitSetting 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 TimeLimit enum now supports a time limit of 5 minutes, update the method like this:

private void UpdateOptionText()
        {
            optionText.text = selectedOption switch
            {
                TimeLimit.FifteenSeconds => "15 Seconds",
                TimeLimit.ThirtySeconds => "30 Seconds",
                TimeLimit.FortyFiveSeconds => "45 Seconds",
                TimeLimit.OneMinute => "60 Seconds",
                TimeLimit.OneMinuteFifteenSeconds => "75 Seconds",
                TimeLimit.OneMinuteThirtySeconds => "90 Seconds",
                TimeLimit.OneMinuteFortyFiveSeconds => "105 Seconds",
                TimeLimit.TwoMinutes => "120 Seconds",
                TimeLimit.FiveMinutes => "300 Seconds",
                TimeLimit.NoTimeLimit => "No Time Limit",
                _ => "Unknown Time Limit"
            };
        }
  1. Save the script.

  2. Locate and open the script named GameSettings.

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

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

    • For example, if your TimeLimit enum now supports a time limit of 5 minutes, update the method like this:

public int GetTimeLimit()
{
            switch (selectedTimeLimit)
            {
                case TimeLimit.FifteenSeconds:
                    return 15;
                case TimeLimit.ThirtySeconds:
                    return 30;
                case TimeLimit.FortyFiveSeconds:
                    return 45;
                case TimeLimit.OneMinute:
                    return 60;
                case TimeLimit.OneMinuteFifteenSeconds:
                    return 75;
                case TimeLimit.OneMinuteThirtySeconds:
                    return 90;
                case TimeLimit.OneMinuteFortyFiveSeconds:
                    return 105;
                case TimeLimit.TwoMinutes:
                    return 120;
                case TimeLimit.FiveMinutes:
                    return 300;
                case TimeLimit.NoTimeLimit:
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
  1. Save the script.

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