Variables not increasing

Hi. I’m a semi - beginner on Unity. Recently, I have been trying to make a rage game. Basically the player has to move a object and dodge the incoming obstacles. I created three variables, one for increasing the obstacle speed, one for the current speed and one for the max speed. However if I do the current speed += increase obstacle speed * time.deltatime inside the Update() function, it does not increase. I was wondering if anyone has a solution to this?

The code I’m using: (the obsSpeed is set to 5 and the increaseObsSpeed is set to 1)

//Obstacle
public Rigidbody2D rb;
public float timeToIncreaseSpeed;
//Obstacle Speed
public float obsSpeed;
public float increaseObsSpeed;
public float maxObstacleSpeed;
//Obstacle effect
public GameObject obsEffect;

private void Update()
{
    obsSpeed += increaseObsSpeed * Time.deltaTime;

    transform.Translate(Vector2.down * obsSpeed * Time.deltaTime);

    if(rb.position.y <= -9f)
    {
        Destroy(gameObject);
    }
}

private void OnTriggerEnter2D(Collider2D collision)
{
    if(collision.CompareTag("Player"))
    {
        //Create effect
        Instantiate(obsEffect, transform.position, Quaternion.identity);
        Destroy(gameObject);
    }
}

Hello, this part of the code seems true. It should increase the obsSpeed.

public float obsSpeed;
public float increaseObsSpeed;
 private void Update()
 {
     obsSpeed += increaseObsSpeed * Time.deltaTime;
 }

Are you sure about the values of the variables? You may have accidentally given 0 to increaseObsSpeed.

Ok. I eventually found out what was wrong. I set the obsSpeed to 5 and every time the gameobject was instantiated the obstacle speed was five. And everytime it was instantiated the increaseObsSpeed was also set to the original value. I fixed it by doing another script on a empty gameobject and set one of the variable to static. Then i set that static variable as the obstacle’s speed. This way the obstacle speed would not reset everytime it was instantiated