I have a ButtonManger.cs file which takes an array of buttons. I want to know how I can change all the buttons colors by the empty object(My ButtonManger Object). so basically once a button(that is in the array) is trigged/clicked it will tell the buttonmanger to change the color of the buttons(in array).
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class ButtonManger : MonoBehaviour
{
public Button[] button;
public string selectedButton { get; private set; }
private void Awake()
{
button = FindObjectsOfType<Button>();
selectedButton = EventSystem.current.currentSelectedGameObject.name;
}
public void OnClickedButton()
{
GetComponents<Button>().material.color = new Color(0.3f, 0.4f, 0.6f, 0.3f);
//this is where I cant get it to work, getComponents<Button>().material doesnt work
}
}```
