Setting SceneView.RenderMode / Lightmapping Show Resolution option from script

Hey Guys,

I’m have a ‘strange’ question. Is it at all possible to set the Scene View render mode from script?

There is a RenderMode enum in SceneView class and that enum also matches the DrawCameraMode enum used in Handles.DrawCamera() method. One of the values of that enum is LightmapResolution which is what I want to set.

I could not find a way to set the current render mode anywhere as there doesn’t seem to be a property or a method to do that in any of the Editor classes.

From what I can gather doing something like this would be the only way to set the ‘Show Resolution’ option displayed on the small Lightmapping editor window. (The one shown in the bottom right corner of the scene view when you switch over to the Lightmapping editor window). Which is really what I’m after.

Actually, setting the scene to render the lightmapping scale overlay is what I’m after :slight_smile:

I tried playing with the DrawCamera method but it did not produce any meaningful results and actually broke other stuff. In rather interesting ways I might add.

Here is how i tried to do it:

    void OnSceneGUI() 
    {
        ...
        // I'm drawing with .current camera because I don't need to change anything other than the mode
        Handles.DrawCamera(Camera.current.rect, Camera.current, DrawCameraMode.LightmapResolution);
        ...
    }
  • Alex

Hey Dudes and Dudets,

I figured it out. It was so simple that I thought it was to good to be true :smile:
Anyway here is how you can mess with the SceneView render mode and pretty much everything else:

    void OnSceneGUI() 
    {
        SceneView activeSceneView;
        
        activeSceneView = (SceneView)SceneView.sceneViews[0];

        activeSceneView.renderMode = SceneView.RenderMode.LightmapResolution;

    }

There is tons more you can do like check currently selected tool, pivot and so on.

Happy coding!