Untitled

                Never    
C#
       
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ScoreButton : MonoBehaviour
{
    public int buttonIndex;
    public Toggle scoreButton;
    // Start is called before the first frame update
    void Start()
    {
        scoreButton = gameObject.GetComponent<Toggle>();
        scoreButton.onValueChanged.AddListener(Clicked);
    }

    // Update is called once per frame
    void Update()
    {
        if (Global.buttonsPressed[Global.currentRound, Global.currentTeam, Global.currentMember, buttonIndex] != scoreButton.isOn)
        {
            scoreButton.isOn = Global.buttonsPressed[Global.currentRound, Global.currentTeam, Global.currentMember, buttonIndex];
        }
        if (Global.buttonsPressed[Global.currentRound, Global.currentTeam, Global.currentMember, buttonIndex] == false)
        {
            scoreButton.interactable = Global.moreButtons;
        }
        else
        {
            scoreButton.interactable = true;
        }
        if (Global.incomplete == true)
        {
            Global.buttonsPressed[Global.currentRound, Global.currentTeam, Global.currentMember, buttonIndex] = false;
            scoreButton.isOn = false;
        }
    }
    void Clicked(bool isOn)
    {
        
        ColorBlock cb = scoreButton.colors;
        if (isOn)
        {
            cb.normalColor = Color.gray;
            cb.highlightedColor = Color.gray;
            Global.buttonsPressed[Global.currentRound, Global.currentTeam, Global.currentMember, buttonIndex] = true;
        }
        else
        {
            cb.normalColor = Color.white;
            cb.highlightedColor = Color.white;
            Global.buttonsPressed[Global.currentRound, Global.currentTeam, Global.currentMember, buttonIndex] = false;
        }
        scoreButton.colors = cb;
    }
}

Raw Text