Why draw rooms you can't see?

They're behind a wall.

Why draw rooms you can't see?

The problem

Only off-screen is skipped.

cam.useOcclusionCulling = false;// everything in front of the camera// is drawn, even behind walls

Without occlusion data, Unity only skips what's outside the camera's view.

The fix

Bake what blocks what.

Mark walls as occluders, objects as occludees, and bake occlusion data.

Occluder Static+bake→hidden is skipped

The fix in code

Mark it in an editor script.

var flags = StaticEditorFlags.OccluderStatic          | StaticEditorFlags.OccludeeStatic;GameObjectUtility.SetStaticEditorFlags(wall, flags);// then bake: Window > Rendering > Occlusion Cullingcam.useOcclusionCulling = true;

The same flags are in the Static dropdown on each object.

Watch out

Where it pays.

It's for walls and rooms. Open fields don't hide much.

Indoor levels
big win
Open terrain
little gain
Moving objects
occludee only

The rule

Hidden means not drawn.

Walls
Occluder Static
Props
Occludee Static
Then
bake