This Unity game prototype is a quiz game featuring a series of multiple-choice questions. The main features include a question system using ScriptableObjects
for easy question management, a timer for each question, a scoring system that tracks correct answers and questions seen, and an end screen displaying the final score. The UI is built with TextMeshPro for crisp text rendering, and interactive answer buttons provide immediate feedback with color and sprite changes based on correctness.
The core game mechanic revolves around answering questions within a time limit. Players select one of several answer buttons; if they answer correctly, their score increases. If time runs out or an incorrect answer is chosen, the correct answer is revealed, and the game progresses to the next question. The game tracks progress with a slider and displays the final score at the end, encouraging re playability.
Technically, the project demonstrates foundational Unity C# skills: using MonoBehaviour
for game flow, ScriptableObject
for data-driven design, UI management with TextMeshPro
and Unity UI components, and basic scene management. By building this game, developers gain experience in structuring a small game project, handling user input, managing game state, and implementing UI feedback—essential skills for beginner to intermediate Unity developers.
[https://drive.google.com/file/d/1Jg5oHfiMollCFmC9k_kFq6v0PVVMKXzG/view?usp=drive_link](https://drive.google.com/file/d/1Jg5oHfiMollCFmC9k_kFq6v0PVVMKXzG/view?usp=drive_link)
Description:
Loads questions from a ScriptableObject
and displays them in the UI, ensuring each question is only shown once per session.
// ...existing code...
private void GetNextQuestion()
{
if (questions.Count > 0)
{
SetCurrentQuestion();
EnableAnswerButtons(true);
SetButtonSprites(defaultAnswerSprite);
progressBar.value++;
scoreText.text = "Score: " + scoreKeeper.CalculateScore() + "%";
}
}
// ...existing code...
flowchart TD
A[Start Game] --> B[Load Questions from ScriptableObject]
B --> C[Display Next Question]
C --> D[Wait for Player Answer]
Description:
Handles player answer selection, checks correctness, updates score, and provides immediate visual feedback.
// ...existing code...
public void OnAnswerSelected(int index)
{
hasAnsweredEarly = true;
DisplayAnswer(index);
SetButtonState(false);
timer.CancelTimer();
}
// ...existing code...
flowchart TD
A[Player Selects Answer] --> B[Check Correctness]
B --> C{Correct?}
C -- Yes --> D[Update Score, Show Green]
C -- No --> E[Show Red, Highlight Correct]