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
- Click AG > TriviaEditor > Trivia to start adding Trivia Questions.
- You can add as many Trivia Questions and fake answers as you want.
- 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.
- Create a new GameObject
- Click add Component and add “Trivia Database Access” Script.
- 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.
- Load TriviaDatabase by running TriviaDatabaseAccess.instance.LoadTrivia(true) which will load trivia and randomize it.
- Get the first question with TriviaDatabaseAccess.instance.GetQuestion() which will return a string of the first question.
- 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.
- After you are done with the trivia question use TriviaDatabaseAccess.instance.PopTrivia() function to remove it from the list to prevent repeating the question.