Hiding UI elements in Unity!

Ok, so recently I tried to find a way to hide UI elements in Unity 5, looked far and wide and apparently its not possible to do something like element.visble = false. So, the easiest solution I found was to set the game objects localScale to 0, e.g:

transform.localScale = new Vector3(0, 0, 0);

And to make visible again use

transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);    // Or whatever original scale the object had