I’m creating a Jeopardy Game. Surely there is a better way to hold question and answer data then what I’m doing.
Currently I’m storing question and answer data in scriptable objects. Each category has a question array and answer array that I can edit in the inspector. Then I have another scriptable object that holds categories to make a game.
Is there a better way to do this? What would you do?
Depends on your objectives. The biggest problem with using ScriptableObjects is that someone would need Unity to create new quiz sets, and if I know one thing about these games, people are going to want to make their own quiz sets. Since questions and answers are just text, it should be really easy to output your data to JSON, and then players would be able to easily edit the JSON text files and make their own; you’d also be able to easily download new quiz sets at runtime.
You can use Unity’s JsonSerializer or LitJson (the former is builtin, the latter is more powerful), which would be able to take a data structure that probably doesn’t need to be changed from what you already have in your ScriptableObject and turns that data into Json.
I recommend checking out a Json tutorial like this one.
My go to would be a CSV file. Makes it easy to edit even outside of Unity, and is a modder friendly format if that is something you’re interested in.
Second for CSV or a simple xml format.
1 Like