Make a gameobject with a character controller inivisble

I am trying to make some game objects invisible. I have looked through the answers, and settled on using “ = false”.

However, while this works on my simple objects, it won’t work on objects which have a character controller attached and I’m not sure why.

Try setting “renderer.enabled = false” instead.

GetComponent(“MeshRenderer”).enabled = false;