How to hide the terrain in a scene while it still works?

As the title shows:

I try use the code below to hide terrain, but the terrain won’t work and the characters just fell down and down…

public void fnHideObjectByTag(string tagName, bool isHide)
{
GameObject[ ] Obj = GameObject.FindGameObjectsWithTag(tagName);
List lstObj = new List();

foreach (GameObject obj in Obj)
{
lstObj.Add(obj);
obj.SetActive(!isHide);
}
}

Can anyone give me some advice?

Just deactivate the terrain (not the whole gameobject) so that the terrain collider is still active

You mean use DeactivateChildren function?
I tried this but it seems not work. Can you give me some reference code? Thank you very much!

No, he means deactivate the Terrain component on your gameobject.
https://unity3d.com/learn/tutorials/modules/beginner/scripting/enabling-disabling-components

Btw those are really good tutorials, you should go through them.

You could also put the terrain on a different layer and set the camera not to render that layer: