Modify a parameter on a disable Gameobject

Hi guys,
I have a problem with my scripts.
I have :
FishsMovements.cs who is attached on multiple Game Objects, and it control the behavior of the movement with :

rb.velocity = -transform.forward * fishSO.speedMovement * speed * Time.timeScale;

– fishSO.speedMovement → is set by a scriptable object
– speed → is a parameter declared into the same script


On an another script, when i want to pause the game a function in FishsMovements.cs is called using singleton to modify the value of speed. By default is set at 1, wanted to do the same behaviour of the Time.timeScale : ( I can’t set time.timeScale to 0 beacause i need to let the time pass (ex: counters, …).
The method called is :

public void PauseMvmnt()
    {
        oldSpeed = speed;
        Debug.Log("1. Make downgrade by : " + oldSpeed);
        speed -= oldSpeed;
        Debug.Log("speed is now : " + speed);
    }

The problem appears here, the value is changed only on activated GameObjects, not on desactivated, if anyone knows how can i reach my objective ^^.


P.S. if need some more info please tell me, i’m at the end of a long night of work my brain is not so fresh ^^ i can have forgot somethings.

Use OnEnable and OnDisable methods instead PauseMovement method. I mean use singleton and after this you can connect this pausable object and just set enable value. Like this;

GetComponent().enabled = false;