I have a question about Invokerepeating.

I have a invoke thingy that repeates here it is:
InvokeRepeating(“Walk”, 1, Frequencywalk - 0.66);

Frequencywalk is set to 1 in a var, but since this invoke is in start, if I edit the variable, nothing happens at all. So I figured it will work under the function update. I put it there, and it either makes it sound once, or not at all…
How would I make it so if I update the variable, it will update?

Try using Invoke instead:

float FrequencyWalk = 5f;

void Start()
{
    Invoke("Walk", FrequencyWalk);
}

void Update()
{
    FrequencyWalk += someModifierValue;
}

void Walk()
{
    //do stuff
    if(stopInvoking) 
        return;
    Invoke("Walk", FrequencyWalk);
}

In this case, every time invoke gets called it will get set with a new time to delay. If you are doing this, you’ll need a way to stop the invoke loop from happening, so make some sort of case that will break the loop.

Sounds like you are trying to do something that invoke repeating was probably not made for. Dynamic repeating durations. You could try out Coroutine and then use your FrequencyWalk variable inside of there. This should be able to accomplish what you want to do if I understand it correctly. If you are still having trouble or if I didn’t understand your problem correctly, let me know.

Here’s an example:

 public void WalkCoroutine()
{
    while (true)
    {
        float timer = 0.0f;
        while (timer < FrequencyWalk - .66)
        {
            timer += Time.deltaTime;
            yield return null;
        }
        Walk();
    }
}

Once this coroutine is started {StartCoroutine(“WalkCoroutine”)} it will only be able to be stopped with StopCoroutine(“WalkCoroutine”). This is a very messy implementation but it will allow you to edit the variable “FrequencyWalk” and have it change the duration in real time.