[SOLVED] Increase obstacle speed over time

Hi, I’m making my first game, a endless runner type game.
I’ve made the code to increase the speed of the obstacles every x score, the problem is that I’m spawning the obstacles by their prefab and when they spawn the speed doesn’t update, they spawn with the same speed every time.

Here is my GameManager script:

 [Header ("ObstacleSpawn")]
    [Space]
    [SerializeField]
    private GameObject[] obstacle;
    [SerializeField]
    private Transform spawnPoint;
    private float nextSpawn;
    [Header("ObstacleSpeed")]
    [Space]
    [SerializeField]
    private float speedIncrease;
    [SerializeField]
    private float speedCount = 5;


if (Time.time > nextSpawn) {
            SpawnObstacle();
        }

 private void SpawnObstacle() {
        nextSpawn = Time.time + Random.Range(5f, 8f);
        int randomObstacle = Random.Range(0, obstacle.Length);
        Instantiate(obstacle[randomObstacle], spawnPoint.position, Quaternion.identity);
    }

    private void IncreaseYourScore() {
        if(Time.unscaledTime > nextScoreIncrease) {
            yourScore += 1;
            nextScoreIncrease = Time.unscaledTime + 1;
            if (yourScore > speedCount)
            {
                speedCount += speedIncrease;
                MoveRightTree[] moveObjects = FindObjectsOfType<MoveRightTree>();
                foreach (MoveRightTree mt in moveObjects)
                {
                    mt.SpeedIncrease();
                }
            }
        }
    }
}

Here is my obstacle script:

private Rigidbody2D rb2D;

    [SerializeField]
    private float moveSpeed;
    [SerializeField]
    private float speedMultiplier = 1.5f;

    private void Start()
    {
        rb2D = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        rb2D.velocity = new Vector2(moveSpeed, rb2D.velocity.y);
    }

    private void FixedUpdate()
    {
        
    }

    public void SpeedIncrease()
    {
        moveSpeed = moveSpeed * speedMultiplier;
    }
}

Change the countSpeed in GameManager a public variable, then in your obstacle script use moveSpeed=GameManager.countSpeed in the start method.