Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by lauti_nipi · Mar 25, 2016 at 05:44 PM · c#2d gamearraysquiz

Randomize text position for 2D Quiz C#

Hi, I'm trying to do a Quiz game by my own. What I'm using are arrays (not ArrayLists) to store the questions and its options. So I have "chemic_Quesitons" a string[] with for example {"Iron", "Cupper"} and I have my other string[] array "options" with "Fe", "Cu", "Co", etc.

My problem: What I am trying to avoid is to don't show the same options on the same place each time, I want lets say option A be placed on the 1° button, option B on the 2° and for the next time I ask the same questions, I want for example option A be placed on the 3° button instead of the 1°. So what I want is to be able to rotate the elements of the array so when I assign them to the buttons, they will have a different possition each time.

What I've tried: I've tried using a For loop and using Random.Range to grab a random element of the "options" array and assign them to a button, this way each time would be different, but as I'm doing it on the Update() function, the elements are constantly being randomize, this causes the texts of each buttons to be constantly changing as the random functions is active all the time.

What I wanted to know is if there is a way to stop the random.range function so it grabs 4 random elements of the array and then it stops, or if there is another way of doing this.

The For loop is just a loop that gives each button a certain string for the "options" array. For example: The first 4° elements of the array would correspond the first quesiton. The second group of 4 to the next question and so on

If more details or information is needed please ask and I'll answer.

This is an example of what the game would be like:

alt text

mini-game3.jpg (89.0 kB)
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

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

2d array isn't declared even though I declared it 0 Answers

C# noob question (array realated) 1 Answer

Modify Array in Editor Window - 2020+ 0 Answers

Point light 2D odd beam of light towards camera 1 Answer

Screenshot preview freezes a game for a few seconds 0 Answers


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