Can I Change Variable Values Within an Invoke Command?

So I’m spawning clouds. I want them to spawn at a much slower speed when my character is standing still, and then spawn faster when he’s running, to keep the sky from filling with clouds when you’re standing still. My code for spawning actually works just fine. The problem is I’m not able to change spawnMax and spawnMin while the level is running. Actually, debug shows me the values are changing, but the Invoke command seems to ignore them. It won’t even let me change the value in the Inspector as the level is running. Is there a better way to do this?

using UnityEngine;
using System.Collections;

public class CloudSpawn : MonoBehaviour
{
    public GameObject player;

    public GameObject[] cloud;
    public float spawnMin = 25f;
    public float spawnMax = 35f;

    // Use this for initialization
    void Start ()
    {
        SpawnCloud();
        player = GameObject.FindGameObjectWithTag("Player");
    }
   
    // Update is called once per frame
    void Update ()
    {
        if(player.rigidbody2D.velocity.x > 0)
        {
            spawnMin = 1f;
            spawnMax = 3f;
            Debug.Log("SpawnMin: " + spawnMin + "  " + "SpawnMax: " + spawnMax);
        }
        else
        {
            spawnMin = 25f;
            spawnMax = 35f;
            Debug.Log("SpawnMin: " + spawnMin + "  " + "SpawnMax: " + spawnMax);
        }
    }

    void SpawnCloud()
    {
        Instantiate(cloud[Random.Range(0, cloud.GetLength(0))], transform.position, Quaternion.identity);
        Invoke("SpawnCloud", Random.Range(spawnMin, spawnMax));
    }
}

I don’t like Invoke() there :-/
You can rewrite your SpawnCloud() as coroutine and replace Invoke method with yeild new WaitForSeconds().

Here is an example:

  // Use this for initialization
  void Start ()
  {
  StartCoroutine(SpawnCloud());
  player = GameObject.FindGameObjectWithTag("Player");
  }
...
   Enumerator SpawnCloud()
  {
     while(true)
     {
       Instantiate(cloud[Random.Range(0, cloud.GetLength(0))], transform.position, Quaternion.identity);
       yield retun new WaitForSeconds(Random.Range(spawnMin, spawnMax));
     }
  }

Ah, that works, and I like that better too. Thanks!