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 /
This question was closed Feb 05, 2014 at 05:37 PM by Graham-Dunnett for the following reason:

Duplicate Question

avatar image
0
Question by Jacques993 · Feb 05, 2014 at 05:35 PM · guiarraysquiz

Making A Question Based Game, How to Ask Randomly

Just working with arrays & GUI using Javascript and wondering what is the best approach to asking random questions from a bank of questions in an array?

Currently using the following method to ask questions when reaching a point but it is obviously rather static i.e. correct answer button in fixed place every time.

function OnGUI ()

{

 if (drawGUI == true)
 {
 
       GUI.skin = MenuSkin;

      GUI.Box (Rect (Screen.width*0.5-51, 200, 402, 22), "What is the Second Letter in the Alphabet?");     
      
      if (GUI.Button (Rect (Screen.width*0.5-51, 230, 198,20), "A")) {
      GameObject.Find("First Person Controller").GetComponent(PlayerStats).playerScore -=2;
      }
      
      if (GUI.Button (Rect (Screen.width*0.5+153, 230, 198,20), "C")) {
      GameObject.Find("First Person Controller").GetComponent(PlayerStats).playerScore -=2;
      }
      
      if (GUI.Button (Rect (Screen.width*0.5+153, 260, 198,20), "D")) 
      {
      GameObject.Find("First Person Controller").GetComponent(PlayerStats).playerScore -=2;
      }
      
      if (GUI.Button (Rect (Screen.width*0.5-51, 260, 198,20), "B")) {
      GameObject.Find("First Person Controller").GetComponent(PlayerStats).playerScore +=10;
      changeDoorState();         
      }
  }    

Any help would be greatly appreciated

Comment
Comments Locked · Show 1
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 Graham-Dunnett ♦♦ · Feb 05, 2014 at 05:37 PM 0
Share

http://answers.unity3d.com/questions/632730/spawning-random-questions-at-a-time.html

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

19 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

Related Questions

Adding Item object to Inventory List 0 Answers

A list of all NPCs in Editorwindow - not working and I'm not sure why 2 Answers

Assets/Scripts/Inventory.cs(9,40): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `Inventory.differentItems' 1 Answer

Add arrays to a big array? 2 Answers

Creating Q&A Quiz game using Dictionaries as the database 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