Basic C# Help Required... GREATLY APPRECIATED

Hi guys,

currently have a lovely inventory system working; however at the moment it generates the items name/number on each icon; i’d like to remove this but every time i do i end up not being able to compile and don’t fully understand what the issue is:

Code:

public void InventoryWindow(int id)
	{
		int cnt = 0;
		
		for(int y = 0; y < Inventory_Rows; y++){
			for(int x = 0; x < Inventory_Columns; x++){
				
			if(cnt < Inventory._Inventory.Count)
			{
				GUI.Button(new Rect(10.5f + (x * Button_Width), 50 + (y * Button_Height), -2.5f + Button_Width, -2.5f + Button_Height), Inventory._Inventory[cnt].Name);
			}
			else
			{	
				GUI.Label(new Rect(10.5f + (x * Button_Width), 50 + (y * Button_Height), -2.5f + Button_Width, -2.5f + Button_Height), (x + y * Inventory_Columns).ToString(), "Inventory Slot Empty"); // Inventory BOX SLOTS HERE 
			}
			
			cnt++;
			}
		}
	}

Help would be greatly appreciated.

Cheers.

David

What is the error that you’re getting, and what are you doing that produces it?

What do you mean by “remove”?

Guess:
If you use “” instead of Inventory._Inventory[cnt].Name it wont show the name.

oops get your name wrong Arterie
this should fix it

    public void InventoryWindow(int id)
        {
public string Name;
            int cnt = 0;
           
            for(int y = 0; y < Inventory_Rows; y++){
                for(int x = 0; x < Inventory_Columns; x++){
                   
                if(cnt < Inventory._Inventory.Count)
                {
                    GUI.Button(new Rect(10.5f + (x * Button_Width), 50 + (y * Button_Height), -2.5f + Button_Width, -2.5f + Button_Height), Name //or "Name");
                }
                else
                {   
                    GUI.Label(new Rect(10.5f + (x * Button_Width), 50 + (y * Button_Height), -2.5f + Button_Width, -2.5f + Button_Height), (x + y * Inventory_Columns).ToString(), "Inventory Slot Empty"); // Inventory BOX SLOTS HERE
                }
               
                cnt++;
                }
            }
        }

Cheers guys,

I thought that; but I get error “Name does not exist in the current context”

bump