How to set SceneView culling mask programmatically?

Hi,

I want to write an EditorWindow tool to allow easy switching between different sets of Layers in the Editor SceneView (instead of laboriously clicking on the Layers drop down). Naively I think that doing

SceneView.lastActiveSceneView.camera.cullingMask = 1<<4 | 1<<10;

should work, but it has no effect.

Any ideas??

Cheers,

Peter

This seems to work:

Tools.visibleLayers = mask;
SceneView.RepaintAll();

Docs

In my case, the RepaintAll was necessary to see the effects immediately, but perhaps it’s not necessary in some contexts.