SetActive is obsolete, what is its substitute?

Hello,

I am trying to find a way to activate (completely disable and hide an UI slider) on a click of an UI button. What I successfully do is when I click a specific UI button it disables an UI slider (the UI slider is still shown but cannot be moved), which is completely fine by me. However, I am trying to change the function a bit by completely hiding the UI slider.

I searched through the Net and found that GameObject.SetActive = true/false works but apparently it worked in previous Unity versions thus it is obsolete and I am wondering what is its substitute?

Any help is appreciated, thank you!

gameObject.SetActive (true);