How to StartCoroutine in Update but once?

Hi! I’m trying to fade TextMesh text using Coroutine. The problem is Update() starts Coroutine many times, so how can I only start coroutine if it is not already started?

Use a boolean. Set its value to be false at the start. Then when you start the coroutine set that variable to be false. Inside Update check if coroutinne has started or not to start the coroutine.

Code is something like:

bool isCoroutineStarted = false;

void Update()
{
    if(!isCoroutineStarted)
    {
        StartCoroutine("MyCoroutine");
    }

}

IEnumerator MyCoroutine()
{
    isCoroutineStarted = true;
}