Array Selection(?)

Hi!

I got a pretty complex thing to ask. I do not know if the title is fitting but here is my question.

I’m making a small game like this one:

It is a Team Fortress 2 Crate Simulator. If you aren’t familiar with Team Fortress 2 crates, here is a explanation. If you are, go a head and skip this chunk of text.
The Team Fortress 2 crates is basically crates that you can open. You can get a key and open them. The crates can contain hats, weapons, “unusual” hats e.t.c. Some random stuff. Weapons have like 70% of uncrating. Hats have about 25%. Unusual hats have like 5%. These numbers aren’t 100% correct because it honestly don’t know.

Now, my question is, how do I get specific items to get selected from a array of items when I click my button? I need a name, icon and a value to appear on the screen. I have made this kind of “array in array” style when I make the items. See bottom of page for example on array in array. I also need the chance of the item to spawn. If I set Item 1’s chance to 80 and Item 2’s chance to 10, Item 1 will appear more frequent then Item 2 will.

If you know what to do, please tell me! And please tell me any code in C#.

Thanks

Array in array example:

alt text

i think you need to create a class for your item.
this class will hold the item name, item prefab or icon name if it’s not like item name and some other properties you want.

here tutorial how to create these:
http://unity3d.com/learn/tutorials/modules/intermediate/scripting/properties

then you need to create an array from the class you created. this might help you with this: Array of custom properties? (C#) - Unity Answers

finally, you can create a button that when you press it it will pick a random number.
this number will be index from that array. then you can use the data from the selected
array variable to display on the screen.

hope it give you some direction…