- Home /
Asking multiple choice question in unity from a file delimited file in excel?
I want to ask people in a trivia game a question from a file delimited file in excel and have multiple questions per room, and through out, no questions re-asked, then a door will open if the majority of them are answered correctly, if not majority correct, then the game boots to main menu. what would the code for this be and how would i implement it to my game. Any help ASAP would be greatly appreciated! thanks guys! :)
Answer by robertbu · Jan 28, 2013 at 05:02 PM
This is a wide open question that is difficult to answer with such a sketchy description. You might have better luck if you take your project a piece at a time and then ask specific questions on the list. Here are two suggestions on places to start.
1) For asking the questions, you'll likely use the GUI class. There are many questions daily that either use GUI methods in their source or ask about GUI. Create a simple project that just asks and answers questions using GUI. Don't worry about your Excel data to start, just put your questions in code or make a public array and fill them in in the inspector.
2) To get your information from Excel into Unity, save it as a .CSV file with .TXT extension. There are other formats you could use other than CSV, but CSV is probably the simplest. To Unity, anything with a .TXT extension is a TextAsset so you can use the methods of the TextAsset class to access the file. You will have to parse the file yourself and move it into a data structure you can use when asking the questions.
Your answer

Follow this Question
Related Questions
As a beginner, How should I learn how to write java code relevant to the Unity Engine? 1 Answer
How do you script in Java? Anyone have some exaple codes I could use? 0 Answers
How do i fix this problem in my code? please help 2 Answers
How to put a GUI in a clickable Gameobject? (with or without using assest IGUI basic) 0 Answers