Render.enabled

So im trying to make my own version of occlusion culling but simpler using a grid based system so.

// this script i want attached to a collider not the object i want to disappear

function OnTriggerEnter() {
// so here i tried many different methods such as :
gameObject.Find(“BOX”);
renderer.enabled = false;
// this just returns that the colldier doesnt have a mesh to render false so it crashs the game
}

So what do i need to do so that i can trigger a render false on a gameobject say on the other side f the map?

gameObject.Find(“BOX”);
renderer.enabled = false;

this does not use the renderer on the BOX, it uses the renderer on whatever object the script is attached to.

if you want to disable the renderer on the BOX, try GameObject.Find(“BOX”).renderer.enabled = false;

A thanks that works great i found code that allows you to make an array of objects you want to disappear but it has null exception errors in it i fixed most of the stuff in it but that one error confuses me so i will just hard code every object in using the fix you gave me in the future i may find away to fix the other code making it more like a tool kit that everyone can use
Thanks :slight_smile: