Why isn't this bool updating?

I have a setup where a bool should be updated every second but it continuously said it was false. Is there anything I did to do this?

private int nextUpdate=1;
void Update{
        if (Time.time >= nextUpdate)
        {
            nextUpdate = Mathf.FloorToInt(Time.time) + 1;
            speedUp = Random.value > 0.5f;
            
        }
        else
        {
            speedUp = false;
        }
}

I’ve tested your code and you are getting SpeedUp turning true correctly. However, the very next frame, it’s getting set to false again because your logic turns it to false whenever time is less than nextUpdate. That means that speedUp is only true for a single frame, not enough to see anything on the screen. You might be better adapting the following code:

using UnityEngine;

public class Test : MonoBehaviour

{
    bool speedUp;

    void Start()
    {
        InvokeRepeating(nameof(ChangeSpeedUp), 1, 1);
    }

    private void Update()
    {
        print(speedUp);
    }

    void ChangeSpeedUp()
    {
        speedUp = Random.value > 0.5f;
    }
}

The InvokeRepeating method takes a start time and a repeat period. If you run that you can see in the console that you are getting true for a number of seconds and then false for a number of seconds. Is that what you were after?