Variable somehow staying still and not changing numbers.

ok so i was just trying to make a game where you push stuff of a platform and i need a variable for obstacle count that is on the main platform(there is 3 platforms, 1st main, 2nd teleportation platform, 3rd platform where all the teleported obstacles go) to make the level end when all the obstacles are pushed off, but when they are pushed off the variable number doesnt move. heres the code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class ButtonManager : MonoBehaviour
{

    public GameObject StartScreen;
    public GameObject LevelsScreen;
    private ObstacleController obstacleController;
    public TextMeshProUGUI obstacleCountText;

    // Start is called before the first frame update
    void Start()
    {
        StartScreen.gameObject.SetActive(true);
        LevelsScreen.gameObject.SetActive(false);
        obstacleCountText.gameObject.SetActive(false);
        obstacleController = GameObject.Find("ObstacleController").GetComponent<ObstacleController>();
    }

    // Update is called once per frame
    void Update()
    {
        obstacleCountUpdater();
    }

    // buttons

    // Levels button
    public void levelsScreen() {
        StartScreen.gameObject.SetActive(false);
        LevelsScreen.gameObject.SetActive(true);
        obstacleCountText.gameObject.SetActive(false);
    }

    public void ExitLevelsScreenButton()
    {
        StartScreen.gameObject.SetActive(true);
        LevelsScreen.gameObject.SetActive(false);
        obstacleCountText.gameObject.SetActive(false);
    }

    public void lvl1()
    {
        LevelsScreen.gameObject.SetActive(false);
        obstacleController.obstacleCount = 1;
        obstacleCountText.gameObject.SetActive(true);
        return;
    }

    public void obstacleCountUpdater()
    {
        obstacleCountText.text = "Obstacles :" + obstacleController.obstacleCount;
    }
}

that was for the buttons and heres for the obstacles :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class ObstacleController : MonoBehaviour
{

    public float obstacleCount = 60;
    public bool ObsatcleOnPlatform2 = false;
   
    // Start is called before the first frame update
    void Start()
    {
        obstacleCount = 0;
    }

    // Update is called once per frame
    void Update()
    {
       
    }

    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.CompareTag("RespawnObstacle"))
        {
            transform.position = new Vector3(0f, -100, 11);
        }

        else if (other.gameObject.CompareTag("ObstaclesGround") && ObsatcleOnPlatform2)
        {
            obstacleCount = 3;
            ObsatcleOnPlatform2 = false;
        }
    }
}

some one please help me.

This code doesn’t make any sense. Don’t you have multiple obstacles? Why does the ObstacleController keep the count variable? Why would they each have their own count? Why does the ButtonManager script only reference a single ObstacleController?

ok so the obstacle count is how much obstacles i have in a map and i will have multiple maps so i set the ibstacle count to thst much obstacles how much is in the current map and when i push off the obstacle the obstacle count should go down by one and when it reaches 0 the game will show you the lvl end screen and the problem is that the obstacle count variable is not going down.

and i want it to get set to three for now for tests and in debug log (wich i dont have for now) it say for one frame 1 and for the second it says 3 and then always one but i need it to always say three when the obstacle is pushed off
please help me fast

Oh nvm i fixed it beacause i was creating 2 variables but editing only one and the other staying the same