Change culling mask of editor's camera

Hello,
I have an object in my scene which I would like to appear in wireframe in the editor view. I firstly tried to change its state with: EditorUtility.SetSelectedRenderState(r, EditorSelectedRenderState.Wireframe); but it works only when the shaded mode is changed to wire.
So now I try to hide the object in the scene view and draw it with gizmo. It works fine, but I have to change the layer of the scene camera manually. Is there a way to change it via script like this :

            Debug.Log(SceneView.lastActiveSceneView.camera.cullingMask);
            SceneView.lastActiveSceneView.camera.cullingMask = 0;
            Debug.Log(SceneView.lastActiveSceneView.camera.cullingMask);

This code does not work, the culling mask never changes.

1 Like

up. Can’t change culling mask of this camera :frowning:

1 Like

Guys, have the same big problem. Does somebody know the solution ???

Is there still no resolution to this?

You can change using Tools class :slight_smile:

3 Likes

Thanks a lot!!!