How do you check if an instance of an object has been clicked on more than once?

I have 5 objects (which are different from each other), where I want to be able to do combos with them, such as tapping 3 of those specific objects will do something. But I only know how to check if 1 object has been clicked using c#.

New to unity. Help appreciated.

1. Add an EventSystem in your scene (GameObject > UI > EventSystem)

2. According to the type of your objects which must be clicked:

a) 3D objects : Attach a Physics Raycaster to the event system

b) 2D objects : Attach a Physics 2D Raycaster to the event system

c) UI objects : Attach a Graphic Raycaster to the event system

3. To each of the objects that should be clicked:

a) 3D objects : Attach a Collider

b) 2D objects : Attach a 2D Collider

c) UI objects : Make sure the object has an image with RaycastTarget enabled

4. Create a new C# script called ClickTarget.cs with the following class, and attach the component to each objects that should be clicked:

using UnityEngine;
using UnityEngine.EventSystems;

public class ClickTarget : MonoBehaviour, IPointerClickHandler
{
    public event System.Action<ClickTarget> OnClicked;

    public void OnPointerClick( PointerEventData eventData )
    {
        if ( OnClicked != null )
            OnClicked.Invoke( this );
    }
}

5. Create a new C# script called Combo.cs with the following class:

using UnityEngine;

[System.Serializable]
public class Combo
{
    public ClickTarget[] Targets;
    public UnityEngine.Events.UnityEvent OnComplete;
    public float maximumClickInterval = 0.5f;

    private int index = 0;
    private float lastClickTime;

    
    public void HandleTarget( ClickTarget target )
    {
        if ( Targets.Length < 1 || Targets[index] == null )
            return;

        // Reset timer if clicked too late
        if ( Time.time > lastClickTime + maximumClickInterval )
            index = 0;

        // Correct target clicked
        if ( target.GetInstanceID() == Targets[index].GetInstanceID() )
            index++;
        else if ( target.GetInstanceID() == Targets[0].GetInstanceID() )
            index = 1;
        else // Wrong target
            index = 0;

        if ( index == Targets.Length && OnComplete != null )
        {
            OnComplete.Invoke();
            index = 0;
        }

        lastClickTime = Time.time;
    }
}

6. Create an empty gameobject with the following ClickTargetsManager script:

using UnityEngine;

public class ClickTargetsManager : MonoBehaviour
{
    public ClickTarget[] Targets;
    public Combo[] Combos;

    private void Start()
    {
        for ( int i = 0 ; i < Targets.Length ; i++ )
        {
            Targets*.OnClicked += OnTargetClicked;*

}
}

private void OnTargetClicked( ClickTarget target )
{
for ( int i = 0 ; i < Combos.Length ; i++ )
{
Combos*.HandleTarget( target );*
}
}
}
* 7. In the inspector, select the ClickTargetsManager, and drag & drop all the objects holding the ClickTarget script into the Targets array*
* 8. Create your combos by dragging & dropping the gameobjects holding the ClickTarget script into the Targets array of each combo.*
* 9. Provide the function you want to call once a combo is completed the same way you do with the OnClick function of a button for example.*
[114287-combos.png|114287]_
Please, next time, provide what you have tried so far
_

edit: Forgot to mention that by checking if 3 of those objects have been clicked consecutively in a certain amount of time, I want it to do something.