Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Change culling mask of editor's camera

Discussion in 'Scripting' started by faren, Jun 23, 2017.

  1. faren

    faren

    Joined:
    Sep 10, 2015
    Posts:
    60
    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:
    Code (CSharp):
    1.  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 :
    Code (CSharp):
    1.             Debug.Log(SceneView.lastActiveSceneView.camera.cullingMask);
    2.             SceneView.lastActiveSceneView.camera.cullingMask = 0;
    3.             Debug.Log(SceneView.lastActiveSceneView.camera.cullingMask);
    4.            
    This code does not work, the culling mask never changes.
     
    CGDever likes this.
  2. usernameHed

    usernameHed

    Joined:
    Apr 5, 2016
    Posts:
    92
    up. Can't change culling mask of this camera :(
     
    CGDever likes this.
  3. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    154
    Guys, have the same big problem. Does somebody know the solution ???
     
  4. putragonist

    putragonist

    Joined:
    Aug 13, 2013
    Posts:
    8
    Is there still no resolution to this?
     
  5. Gok11

    Gok11

    Joined:
    Nov 11, 2014
    Posts:
    3
  6. whdinasor

    whdinasor

    Joined:
    Jan 14, 2014
    Posts:
    2