Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JoshMBeyer · Dec 09, 2014 at 09:23 PM · c#listfile

Simple Questionnaire Game Logic?

What I want to do, think of a simple multiple choice question with only one correct answer.

Questions: What is 2+2?

A: 2 B: 22 C: 44 D: 4

Obviously D is the correct answer in this case. But the point of this is that I have a text file with about 1000 or so questions and each question has 4 possible answers with only 1 being the CorrectAnswer. I want the game to display this with GUI and I already know how to do that. If the answer is correct, then move to the next question randomly, but.. do not ask this question again. Kind of unmark it from the list of questions to show. But if its incorrect, put this this question back into the pile and randomly move to another question eventually asking this question again. I cannot figure out a few things on doing all of this.

What is the simplest way to produce this. Should I try accessing a text file with all the questions and answers, or should i create a script that contains them all in blocks. and the questionnaire script access that instead. And how should I do the randomizing? Random.Range? and of list? or array? How to unmark(Possibly could just Question[1].Remove or something) This is really important to me so any help would be greatly appreciated. I'm not trying to ask for a fully written script, I just need some help/advice Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by hexagonius · Dec 09, 2014 at 09:31 PM

A friend of mine is using XML parsing for that kind of stuff. Jason might be better do as well. I would stick to the text file since it's easier to manage and external to your scripted logic. You should definitely check on parsing. Then, you could assign unique numbers to your questions and answers, read them all once into a list and move already answered ones from that list to a used list, or something like that. Or parse the numbers back into a used text file for later. Parsing... ;)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Vandarthul · Dec 10, 2014 at 03:14 PM

I'm not sure if this is the best solution or an optimal one but I would try to do this:

  1. Create a class that holds Question text, A, B, C, D choices, the true answer

  2. Create a list of that class and pull all questions to the list.

  3. Select random list item(Random.Range would work just fine)

  4. After the question is answered, tell the player if it's being answered corretly and copy that list item to another list so you can store and reach already asked questions maybe with the answer given by player too, or just remove the list item.

That's pretty much it for me I think.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Before I waist a ton of time... Need help 1 Answer

A node in a childnode? 1 Answer

Scripting and Coding Dictionary 0 Answers

How to add elements from a List of another class to another List (C#) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges