• 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
Question by rhyvon · Apr 18, 2015 at 10:50 PM · javascriptarrayrandom

Assigning array values and deleting them from array after assigned

I'm working on a trivia game and running into a problem that i don't know how to solve. In the game the player must guess what's on a photo. They get 14 letters, which are all stored in an array (7 letters are the answer of the photo and 7 letters are random generated).

I need to assign all the letters from the array to a random ui.text (or something else). After the letter is assigned is must be delete from the array. That way i can't be picked and/or assigned again. This has to loop until the array is empty and all the letters are assigned to an ui.text

I'm a bit of a beginner i'm stuck on how to do this. Can somebody please help me with this problem? :) That would be awesome!

Thanks!!

Comment

People who like this

0 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 Lo0NuhtiK · Apr 18, 2015 at 10:52 PM 0
Share

http://answers.unity3d.com/questions/284054/lists-c.html

https://msdn.microsoft.com/en-us/library/5cw9x18z.aspx

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Soos621 · Apr 18, 2015 at 11:47 PM

Lists would probably be your best shot since you can add and remove references from it.

https://unity3d.com/learn/tutorials/modules/intermediate/scripting/lists-and-dictionaries

https://msdn.microsoft.com/en-us/library/6sh2ey19.aspx

Comment

People who like this

0 Show 2 · 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 rhyvon · Apr 19, 2015 at 10:36 AM 0
Share

Thanks for your response. I'm using Javascript... Is using lists the way to go, to solve this problem? In the links you gave they are talking about C#.

avatar image Soos621 · Apr 19, 2015 at 01:48 PM 0
Share

import System.Collections.Generic;

public var myList : List.; // Insert TYPE (gameobject, float, or w/e, lists are generic so they don't care about what goes into them as long as they are all the same type originally designated)

i personally use c# so im not positive on all the correct syntax but it should be easily translated into java from c#

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Need help to play a random explosion sound from an array. 1 Answer

Storing Inventory Item Properties 2 Answers

randomizing arrays 2 Answers

How would i use a 2D array for level generation 0 Answers

Two different random numbers 2 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