I'm Geting A Null Refrance Even Thought It Is Auto Assigned

I can not work out why I’m getting a NullReferenceException on a variable.
The code where I try and access it.The Error is on Line 19 but I will have a guess that it also will hapen on line 20 where I try and access it again.

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

public class LootChest : MonoBehaviour {

	public int MaxItems;
	int ItemCount;
	List<Item> Items = new List<Item>();

	public Color HoverColour;
	public Color ClickColour;
	Color DefaltColour;
	// Use this for initialization
	void Start () {
		DefaltColour = renderer.material.color;
		ItemCount = Random.Range (1,MaxItems);
		for (int i = 0; i < ItemCount; i++) {
			int r  = Random.Range(0,GameManager.Instance.AllItems.Count - 1);
	// Update is called once per frame
	void Update () {

	void OnMouseOver(){
		renderer.material.color = HoverColour;

	void OnMouseDown(){
		renderer.material.color = ClickColour;
	void OnMouseExit(){
		renderer.material.color = DefaltColour;

The code where it is from.

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

public class GameManager : MonoBehaviour {
	public List<Item> AllItems = new List<Item>();
	public static GameManager Instance;

public class Item{
	public string Name;
	public Texture2D Icon;
	public ItemInstance Instamce_Prefab;

I think AllItems.Count() is your NRE because I don’t know that AllItems = new List() is actually getting called since that code is not in a constructor, its just in the class declaration.

Think the best advice anyone can give you is to shelve this for now, and work on something easier. Then come back to it with more experience.

That seems like an odd set up. What purpose does the static Instance serve? Is it supposed to point to some previously created gameObject with GameManager on it? So the idea is to cache a gameObject.Find in a central location? Is someone 1-time suppose to set GameManager.Instance = GameObject.Find("managerGO").GetComponent?

After line 15, test which part fails: Debug.Log(GameManager.Instance); Debug.Log(GameManager.Instance.AllItems);. One of those is null. I’d guess Instance was never assigned.