i have been trying to add stuff to a a list that i have created in another class but it won’t let me
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class column:MonoBehaviour
{
public List<row> columns=new List<row>();
}
public class row:MonoBehaviour
{
public List<Image> rows=new List<Image>();
}
public class ButtonNav : MonoBehaviour {
float h;
float v;
column menuOptionColumn ;
row menuOptionRow;
public int menuColumnNum=2;
public int menuRowNum=3;
public Image[] menuOptions;
[HideInInspector]public int xPos=0;
[HideInInspector]public int Ypos=0;
int counter =0;
// Use this for initialization
void Start () {
for (int i =0; i<menuColumnNum; i++)
{
while(counter < menuRowNum)
{
menuOptionRow.rows.Add(menuOptions[counter]);
//Debug.Log (menuOptionRow.rows[0]);
counter++;
}
menuOptionColumn.columns.Add(menuOptionRow);
}
}
// Update is called once per frame
void Update () {
h = Input.GetAxis ("Horizontal")*Time.deltaTime;
v = Input.GetAxis ("Vertical")*Time.deltaTime;
menuButtonNavigation ();
}
void menuButtonNavigation()
{
//Debug.Log ();
menuOptions[0].color = Color.green;
if (h < 0)
{
if(xPos>1)
{
xPos-=1;
menuOptionRow.rows[xPos].gameObject.renderer.material.color = Color.green;
}
}
}
}
and this is the error
please someone can i would really appreciate it