Inventory GUI Problem with "GUIContent"

So I have been trying to put togeather a nice inventory system based on “Der Dude’s” code from “here” and modified versions of it from “here” and convert it into C#.

The problem is that I get and error when I try to display description on items.
“error CS0119 : Expression denotes a type', where a variable’, value' or method group’ was expected”

The error is on line (57) in Inventory.cs and the code looks like this:

Inventory.cs

using UnityEngine;
using System.Collections;

public class Inventory : MonoBehaviour 
{


	public Texture emptyTex;
	int iconWidthHeight = 20;
	int spacing = 0;
	
	public int inventoryWidth; // the number of columns to display the inventory in
	public int inventoryLength; // the size of the inventory in total number of slots
	
	private ItemClass[] inventory;// = new ItemClass[inventoryLength];
	
	// Create the an 8x8 Texture-Array 
	public void Awake() 
	{ 
		inventory = new ItemClass[inventoryLength];
		for (int i = 0; i < inventory.Length; i++)
		{
			inventory[i] = null;
		}
	} 
	
	public void OnGUI() 
	{ 
		//Texture texToUse;
		int j;
		int k;
		ItemClass currentItem; // Establish a variable to hold our data
		Rect currentRect;
	    
		//Go through each row 
	    for( int i = 0; i < inventory.Length; i ++ ) 
	    { 
			j = i / inventoryWidth; // ... divide by array by width to get rows...
			k = i % inventoryWidth; // ... find the remainder by width to get columns...
			currentItem = inventory[i]; // ... set this point in the matrix as our current point ...
			currentRect = (new Rect (/*offSet.x + */k * (iconWidthHeight + spacing), /*offSet.y +*/ j * (iconWidthHeight + spacing), iconWidthHeight, iconWidthHeight));
			
			if (currentItem == null) // ... if there is no item in the j-th row and the k-th column, draw a blank texture
			{
				GUI.DrawTexture (currentRect, emptyTex);
			}
			else
			{
				GUI.DrawTexture (currentRect, currentItem.itemIcon);
			}
			 
			// If there is an item at this location and there is a button click...
			if (currentItem != null /* GUI.Button (currentRect, "", GUIStyle ("label"))*/)
			{
				if (Input.GetMouseButtonUp (0)) // ... if that click is mouse button 0: see the description
				{
					GUIContent (" " + currentItem.itemDesc); // Get the description out
				}
	
			}
	    } 
	} 
	
	public void AddItem(ItemClass item)
	{		
		for (int i = 0; i < inventory.Length; i ++) // Go through each row
		{
			if (inventory[i] == null) // If the position is empty..
			{
				inventory[i] = item; // ... add the new item....
				return; // ... and exit the function.
			}
		}
		Debug.Log ("Inventory is full");
	return;
	
	   
	
	    //If we got this far, the inventory is full, do something appropriate here 
	
	}

}

ItemClass.cs

using UnityEngine;
using System.Collections;


public class ItemClass : MonoBehaviour {
	
	public string itemName;
	public Texture2D itemIcon;
	public string itemDesc;	
	
}

ItemPickup.cs

using UnityEngine;
using System.Collections;

public class ItemPickup : MonoBehaviour {
	
	public GameObject thisItem;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnTriggerEnter(Collider collider){
		if(collider.gameObject.tag == "Player") 
		{
			
			Inventory looterInventory = collider.GetComponent<Inventory>();
			
			looterInventory.AddItem(thisItem.GetComponent<ItemClass>());
	
			this.gameObject.tag = "Untagged";
			Destroy(this.gameObject);
		}
	}
}

Here:

        if (Input.GetMouseButtonUp (0)) // ... if that click is mouse button 0: see the description
                {
                    GUIContent (" " + currentItem.itemDesc); // Get the description out
                }

you try to call GUIContent method, but I not see such method in this class. I strikes me as you was going to do some other thing create new GUIContent or call GUIContent method of some variable.

I suggest initializing the array of GUIContents in Awake.

This way you would create your GUIContents (using the new operator) only at the beginning.

awesome thank you! I totally missed that.