Trivia Framework  1.1
Trivia Framework Documentation

Introduction

Trivia Framework assist you in creating your Trivia Game by handling the database of Questions and answers. Making it easy for you to add/edit/remove Questions/Answers/Categories.

Database Location

The Databases are Stored under Assets/TriviaDatabase/Resources/ they can be moved anywhere in the project folder, however they must be in a Resources folder in order for unity to find them.

Quick Start

  1. Click AG > TriviaEditor > Trivia to start adding Trivia Questions.
    Trivia Editor Menu
  2. You can add as many Trivia Questions and fake answers as you want.
    Trivia Editor
  3. By Default it creates a Default Category on start however you can change its name and add other categories by going to Categories under the AG menu.
  4. Create a new GameObject
  5. Click add Component and add “Trivia Database Access” Script.
    AddComponent
  6. Then just use TriviaDatabaseAccess.instance to access the various functions to get Trivia questions and answers along with some functions to make things easier like randomizing answers.
  7. Load TriviaDatabase by running TriviaDatabaseAccess.instance.LoadTrivia(true) which will load trivia and randomize it.
  8. Get the first question with TriviaDatabaseAccess.instance.GetQuestion() which will return a string of the first question.
  9. Getting an answer it would be TriviaDatabaseAccess.instance.GetAnswers()[0].answer or TriviaDatabaseAccess.instance.GetRandomizeAnswers()[0].answer for text of first answer and .image for the image.
  10. After you are done with the trivia question use TriviaDatabaseAccess.instance.PopTrivia() function to remove it from the list to prevent repeating the question.