What is the best way to create all items(weapons) for my game?

I’ve been stuck on this for a few days now and decided to seek help here.

Basically, I would like to create all the weapons that my game will have, and be able to add more in the future. Each weapon will have variables attached to them.

So far, I have created a public class for the items’ details

public class Item
{
	var Name : String;
	var Description : String;
	var ID : int;
	var icon : Texture2D;
	var equipped : boolean;
	var Stamina : int;
	var Power : float;
	var AttackSpeed : float;
	var Rarity : Rarity;
	var itemType : ItemType;
	var itemlevel : int;
}

My actual list of items is in another script. It’s just a standard builtin Array.

static var items : Item[];

I know that I can change the size in the inspector and make all my items there. But I feel that it is very fragile. I can easily accidentally move the items variable ot change the size and it would delete all my items. I would like a way to properly code each item in. Then, I can just call a weapon from the id or name to add it to my characters inventory etc.

I should also add that my game is gui based. There are inventory tutorials out there, but they all seem to be for 1st or 3rd person games and don’t necessarily apply here.

See this similar answer. For a good design choice, you need to involve OOP.
So you have an inheritance tree of Item → Weapon → Spear, Sword, etc | HealthItem, etc. Or use a mix of inheritance and interfaces like the 2nd solution in the link above.

Your current design will cause you problems, you have everything inside your Item class, you have things that shouldn’t be there in the base Item class, like the attack-related stuff, which should be in your Weapon class. How would you then make other items, like health items? If you inherit from your current Item class, they would contain things, that they don’t need (attack-related stuff). Make sure you split your classes, let your Item class contain only the things that are common between all your items, same for the Weapon class, weapon-wise, etc.

And please please don’t use statics unless you’re really sure and know what you’re doing, see this for a good explanation on where to use a static variable (skip to the part where I talk about good coding habits).

One more tip, from a brother to another, I’ve walked the path of making an inventory, if you’re willing to do anything GUI-serious, please don’t go with UnityGUI, use another GUI system, like NGUI. Trust me, doing so you’re saving yourself a TON of headaches and hair tearing moments. The good news is, the new UnityGUI which will be coming in Unity 4.X (god knows when) is gonna be based on NGUI (think of it as a SUPER NGUI) AND the latest NGUI 3.0 is designed to be very similar and close to the new Unity gui, so that migration becomes very easy, see this for more info.

If you don’t wanna buy NGUI and yet do something GUI-serious (working on a real game), I suggest you wait till the new GUI comes out. Or at least, don’t make a lot of moves that are ‘current Unity GUI’-dependent, as that will make migration harder.