Inventory Error

Well, basically I’m following along a tutorial for inventory systems (spent waaayyyy to long trying to do it and not know what stuff does) and I’m getting an error that I’ve never seen before and I can’t seem to get much info on because ever instance of the error seems to be slightly different.

The Error:
Assets/Scripts/InventoryM.cs(27,64): error CS1955: The member `InventoryM.Bag’ cannot be used as method or delegate

The Inventory code (see line 27):

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class InventoryM : MonoBehaviour {
	public List<Items> Inventory;
	public Items[] Bag;
	private Rect windowRect = new Rect(10, 300, 300, 200);
	private RaycastHit hit;
	private Ray ray;
	
	// Use this for initialization
	void Awake () {
		Inventory = new List<Items>();
		
	}
	
	// Update is called once per frame
	void Update () {
		ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		if(Input.GetButtonDown("Fire1"))
		{
			if(Physics.Raycast(ray,out hit,20))
			{
				for(int i = 0;i < Bag.Length;i++)
				{
					if(hit.collider.tag == Bag(i).id.ToString)
					{
						Inventory.Add(Bag*);*
  •  				Destroy(hit.collider.gameObject);*
    
  •  			}*
    
  •  		}*
    
  •  	}*
    
  •  }*
    
  • }*

  • void OnGUI ()*

  • {*

  •  windowRect = GUI.Window(0, windowRect, Domywindow, "Inventory" );*
    
  • }*

  • void Domywindow(int windowId)*

  • {*

  •  int y = 20;*
    
  •  GUI.DragWindow(new Rect(0,0,300,20));*
    
  •  for(int i = 0;i < Inventory.Count;i++)*
    
  •  {*
    

_ GUI.Button(new Rect(20,20,64,64),Inventory*.icon);_
_
y += 70;_
_
}_
_
}_
_
}*_
Thanks guys, later.

You index into an array using square brackets (‘[’, ‘]’), so line 27 should be:

if(hit.collider.tag == Bag*.id.ToString)*

Since you use parentheses, it though you were trying to call a method (function in C# parlance), but ‘Bag’ cannot be used as a function.