Grid Inventory (Multislot)

I am trying to create a multislot inventory like a grid it works for 2*2 or if the length is just 2 but if the length is bigger it doesnt create the whole thing here is the script so far any help or suggestions.

	public int gridWidth;
	public int gridLength;

	public float SlotSize;
	public float gridStart;

	public GUITexture Slot;

	private float currentGridW;
	private float currentGridL;

	private int f;

	void Awake(){

		currentGridW = gridStart;
		currentGridL = gridStart * 2f;
		f = 2;


		for (int i = 0; i < gridWidth; i++) {
			float newGridW = currentGridW;
			
			GUITexture gridW;
			
			gridW = Instantiate (Slot) as GUITexture;
			gridW.pixelInset = new Rect (newGridW, 0f, SlotSize, SlotSize);

			gridW.name = "Slot " + 0 + "," + i;

			currentGridW += SlotSize;

			if (gridWidth >= 1){
				
				for (int g = 0; g < gridLength - 1; g++) {
					float newGridL = currentGridL;
					GUITexture gridL;
					
					gridL = Instantiate (Slot) as GUITexture;
					gridL.pixelInset = new Rect (newGridW, newGridL, SlotSize, SlotSize);
					
					gridL.name = "Slot " + i + "," + (g + 1);

					if(gridLength - 1 >= f){
						currentGridL += SlotSize;
						f = f + 1;
					}
				}
			}
		}
	}

	void Update(){

		Debug.Log (f);
	}
}

There is a very good Unity Tutorial series on YouTube which makes such an inventory, and even allows one to add images, text and the number of items that are in that slot.

Basic Inventory: Unity 3D Tutorial Part 30: Inventory GUI - YouTube

Adding Items: Unity 3D Tutorial Part 34: Adding Items To Inventory - YouTube

Text and Tooltips: Unity 3D Tutorial Part 35: Text And ToolTips!!! - YouTube

Backing it Up: Unity 3D Tutorial Part 36: Backing Up The Inventory - YouTube

I always find that watching a YouTube tutorial, thus doing the work myself, educates me about the subject, thus I am more likely to be able to solve errors and add new content to the scripts.