Inventory array add error

Well I’ve used this exact command before and I never recieved an error so I assume its somewhere else in the script.

The Error:

Assets/Scripts/BaseGirlControl.cs(121,64): error CS1061: Type `UnityEngine.GameObject[]' does not contain a definition for `Add' and no extension method `Add' of type `UnityEngine.GameObject[]' could be found (are you missing a using directive or an assembly reference?)

The Code.

using UnityEngine;
using System.Collections;

[AddComponentMenu("Camera-Control/Mouse Look")]
public class BaseGirlControl : MonoBehaviour {
	// Health & Heat
	
	public int maxhealth = 100;
	public int curhealth = 100;
	private float healthbarlength;
	
	public int maxheat = 100;
	public int curheat = 100;
	private float heatbarlength;
	
	public Transform GameController;
	
	
	// movement
	
	public float animSpeed = 1.5f;
	public float speed = 10.0f;
    public float RotationSpeed = 100;
	private Animator anim;
	
	// in hand items
	
	public string pickupTag;
	private Transform pickuploc;
	private Transform rightPalmloc;
	private bool RightHandEquip;
	public bool collideweapon;
	
	// Non in-hand items
	
	private RaycastHit hit;
	private Ray ray;
	private bool rendermenu;
	
	public GameObject[] InventorySlots = new GameObject[3];
	
	// Use this for initialization
	void Start () {
		pickupTag = null;
		anim = GetComponent<Animator>();	
		RightHandEquip = false;
		collideweapon = false;
	}

	
	// Update is called once per frame
	void Update () {
		HandlesGUI hg = (HandlesGUI)GameController.GetComponent("HandlesGUI");
		if (hg.Rendermenu == true)
		{
			rendermenu = true;
		}
		else
		{
			rendermenu = false;
		}
		AddjustCurrentHealth(0);
		AddjustCurrentHeat(0);
		float h = Input.GetAxis("Horizontal");
		float v = Input.GetAxis("Vertical");
		anim.SetFloat("Speedz", v);			
		anim.SetFloat("Speedx", h);
		anim.speed = animSpeed;
		if (Input.GetMouseButton(1)) 
		{
		}
		else
		{
			if(rendermenu == false)
			{
				transform.Rotate(0, Input.GetAxis("Mouse X"), 0 * Time.deltaTime * speed);
			}
		}
		
		
		
		// Handles weapons / In hand items
		
		
		if (Input.GetButton("InteractionKey"))
		{
			if (collideweapon == true)
			{
				if (pickupTag != null)
				{
					pickuploc = GameObject.FindWithTag(pickupTag).transform;
					pickuploc.GetComponent<WeaponControl>().ispickedup = true;
					rightPalmloc = GameObject.FindWithTag("GrippingHand").transform;
					pickuploc.transform.parent = rightPalmloc.transform;
					RightHandEquip = true;
				}
			}
		}
		if (Input.GetButton("DropWeaponKey"))
		{
			if (RightHandEquip == true)
			{
				pickuploc = GameObject.FindWithTag(pickupTag).transform;
				pickuploc.GetComponent<WeaponControl>().ispickedup = false;
				RightHandEquip = false;
			}
		}
		
		// Handles Clicking in gui mode to pick up items
		
		if(rendermenu == true)
		{
			ray = Camera.main.ScreenPointToRay(Input.mousePosition);
			if(Input.GetButtonDown("Fire1"))
			{
				if(Physics.Raycast(ray,out hit,20))
				{
					Debug.Log(hit.collider.tag);
					if(hit.collider.tag == "Item")
					{
					    InventorySlots.Add(hit.collider.gameObject);
					}
				}
			}	
		}
	}
	void OnGUI ()
	{
		// Health system
		if (rendermenu == true)
		{
			GUI.Box(new Rect(10, 10, 120, 20), "Health");
			GUI.Box(new Rect(10, 30, healthbarlength, 20), curhealth + "/" + maxhealth);
			
			GUI.Box(new Rect(10, 50, 120, 20), "Heat");
			GUI.Box(new Rect(10, 70, heatbarlength, 20), curheat + "/" + maxheat);
		}
	}
	
	// Health system
	
	public void AddjustCurrentHealth(int adj) {
		curhealth += adj;
	
		if(curhealth < 0)
			curhealth = 0;
		
		if(curhealth > maxhealth)
			curhealth = maxhealth;
		
		if(maxhealth < 1)
			maxhealth = 1;
		
		healthbarlength = (Screen.width / 2) * (curhealth / (float)maxhealth);
		
		if(curhealth == 0)
			Application.LoadLevel("MainMenu");
	}
	
	public void AddjustCurrentHeat(int adjh) {
		curheat += adjh;
	
		if(curheat < 0)
			curheat = 0;
		
		if(curheat > maxheat)
			curheat = maxheat;
		
		if(maxheat < 1)
			maxheat = 1;
		
		heatbarlength = (Screen.width / 2) * (curheat / (float)maxheat);
		
		if(curheat == 0)
			Debug.Log("Heatcold");
	}
}

Second stupid question today, sorry guys this will be my last. Thanks allot, I apologize for the trouble.

InventorySlots ia array which doesn’t have an ‘Add’ method. The ‘Add’ method is in .NET Lists. So make this work you would declare InventorySlots like this on line 40:

public List<GameObject> InventorySlots = new List<GameObject>();

And at the top of the file:

using System.Collections.Generic;