I've created a list in a unity script called "Menu Selection" that's attached to a game object called "MenuScene." In that script, I made a list called "items" that I want to reference in another script. This is a snip of what I have, but I keep getting the error, "object reference not set to an instance of an object unity."
Here is part of the Menu Selection Script
public List<string> items;
void Update () {
Debug.Log(items.Count);
}
public void onCoconutClick()
{
items.Add("coconut");
}
And here's the script where I'm trying to use the "items" list
public List<string> list ;
public string name;
// Use this for initialization
void Start () {
OGMat = GetComponent<Renderer>().material;
list = GameObject.Find("MenuScene").GetComponent<MenuSelection().items;
}
Anyone know what's going on?