My buttons do not change to black when mouse click occurs, the problem begins with the array not working. The code is as tutorial. The error i get when trying to build the script is:
public class Button : MonoBehaviour {
private Button[] buttonArray;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseDown (){
print (name + " pressed");
// loop through buttons in the Array
foreach (Button thisButton in buttonArray) {
thisButton.GetComponent<SpriteRenderer> ().color = Color.black;
}
GetComponent<SpriteRenderer> ().color = Color.white;
}