How to implement pausing of WaitForSeconds based coroutine?


I am looking for a pausing solution.
The issue is that my game has a double score power-up for 10 seconds:
private bool isDoubleScoreActive;
private int runningDoubleScoreCoroutinesCount;

EventManager.TriggerEvent("DoubleScore"); // triggers the event

private void OnDoubleScore(object sender, object parameters)
        StartCoroutine(DoubleScore()); // starts the coroutine

    private IEnumerator DoubleScore()
        if (!isDoubleScoreActive)
            isDoubleScoreActive = true; // any score added gets doubled
        runningDoubleScoreCoroutinesCount += 1; // used to track if we have active coroutines so we can extend the length of the power-up
        yield return new WaitForSeconds(10); // the power-up lasts for 10 sec
        runningDoubleScoreCoroutinesCount -= 1; // the coroutine is done
        if (runningDoubleScoreCoroutinesCount == 0) // if this is the only coroutine, the power-up has ended
            isDoubleScoreActive = false;

And this kind of pattern makes it impossible to pause the game, anyone has any idea how to solve this?
The only idea I have is to make a function update time each frame and stop changing time when paused is set to true. Are there any better solutions?

Thanks for your time

WaitForSeconds is using scaled time, so when you set your timescale to 0 your corutine will not be executed in pause. Or you want to run this corurine even when in pause mode? In that case use lWaitForSecondsRealtime which is independet from timescale.