How to record the time of pressing the UI buttons, and repeat the press.

How to record the time of pressing the UI buttons, and repeat the press.
For example: clicked on the first button (the object changed color), after 2 seconds, clicked on the second (the object increased), after a second clicked on the third (the object became as before).
After he pressed a special button and all the actions were reproduced.
Perhaps you know examples or plugins.

You just need variables to keep track of when you press buttons. I would probably put it all in a class. Like have an action class and then have a float timePressed in it. Then you can keep track of when every action was executed and you can make a recording of it by putting it in a list. Then you execute it based on your timePressed value.

I did. Algorithm:
1.add the desired button to the script

  1. add her OnClick event with the desired method from this script
    3.create coroutine in the script if it is not

  2. call it a separate method by pressing

    using UnityEngine;
    using UnityEngine.UI;

    public class Click_tracking : MonoBehaviour
    {
    //массивы для записи времени нажатий каждой кнопки
    public float _time; public float _time1; public float _time2; public float _time3; public float _time4; public float _time5; public float _time6; public float _time7; public float _time8; public float _time9; public float _time10;

    public int[] _counts; //счётчики количества нажатий
    public Button[] _button;
    
    bool _cheakTimer = false;
    public float _timer; //таймер
    
    private void Update()
    {
        _timer += Time.deltaTime;
    }
    
    public void NewMethod() // методы для фиксации времени нажатий
    {
        if (!_cheakTimer)
        {
            _time[_counts[0]] = _timer;
            _counts[0] += 1;
        }
        Debug.Log(_button[0]);  
    }
    
    public void NewMethod1()
    {
        if (!_cheakTimer)
        {
            _time1[_counts[1]] = _timer;
            _counts[1] += 1;
        }
    }
    
    public void Reproduce() // метод для запуска корутин
    {
        _cheakTimer = true;
        _timer = 0.0f;
    
        StartCoroutine("Zero");
        StartCoroutine("First");
        StartCoroutine("Second");
       
        Debug.Log("Старт корутины");
    }
    
    public IEnumerator Zero() // корутины для вызова нажатий
    {
        for (int i = 0; i < _counts[0]; i++)
        {
            if (i == 0)
            {
                yield return new WaitForSeconds(_time*);*
    

_button[0].onClick.Invoke();
Debug.Log(“Есть первое пробитие”);
}
else
{
yield return new WaitForSeconds(_time - _time[i - 1]);
_button[0].onClick.Invoke();
Debug.Log(“Есть второе пробитие”);
}
}

}
public IEnumerator First()
{
for (int i = 0; i < _counts[1]; i++)
{
if (i == 0)
{
yield return new WaitForSeconds(time1*);
button[1].onClick.Invoke();*
Debug.Log(“Есть первое пробитие”);

}
else
{
yield return new WaitForSeconds(time1 - _time1[i - 1]);
_button[1].onClick.Invoke();
Debug.Log(“Есть второе пробитие”);
}
}
}
public IEnumerator Second()
{
for (int i = 0; i < _counts[2]; i++)
{
if (i == 0)
{
yield return new WaitForSeconds(time2*);
button[2].onClick.Invoke();*
Debug.Log(“Есть первое пробитие”);

}
else
{
yield return new WaitForSeconds(time2 - _time2[i - 1]);
_button[2].onClick.Invoke();
Debug.Log(“Есть второе пробитие”);

}
}
}
public IEnumerator Third()
{
for (int i = 0; i < _counts[3]; i++)
{
if (i == 0)
{
yield return new WaitForSeconds(time3*);
button[3].onClick.Invoke();*
Debug.Log(“Есть первое пробитие”);

}
else
{
yield return new WaitForSeconds(time3 - _time3[i - 1]);
_button[3].onClick.Invoke();
Debug.Log(“Есть второе пробитие”);
}
}
}
}_