how to turn of the mesh renderer when the player isn't looking

Hi all

I’m looking for a short “if statement”, or 2, which can tell weather the camera is facing it or not/weather the camera can see it. As i’m making an android game I would want quite powerful graphics but still able to render on about 80Mg of RAM.

thanks in advanced.

Objects not in view aren’t rendered. No need to turn of the renderer.

What you are looking for is called frustum culling - unity implements that by default in its camera ((see section Clip Planes). The somewhat more advanced occlusion culling is a default feature for Unity Pro only, though.

Monobehviour has two events that you can use: OnBecameVisible and OnBecameInvisible. Here’s the script reference: