All Counts

Helllo who help me i create sript but not all work i need check up all matchdates if at least 1 conformity in day script setactive true else secattive false …here is script

using UnityEngine;

public class DateEnable : MonoBehaviour
{
    public string date;
    public string[] matchdates;

    private void Awake()
    {

        date = System.DateTime.Now.ToString("dd/MM/yyyy");
    }

    void Start()
    {
      

      
    }

    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < matchdates.Length; i++)
        {

            if (date == matchdates[i] )
            {
                this.gameObject.SetActive(true);
            }else
                this.gameObject.SetActive(false);
        }
    }
}

Try this:

    void Update()
    {
        for (int i = 0; i < matchdates.Length; i++)
        {
            if (date == matchdates[i] )
            {
                this.gameObject.SetActive(true);
                return;
            }
        }

        this.gameObject.SetActive(false);
    }

thanks verry much