Overdraw Mode

Hi Guys

I stumbled upon Overdraw mode in the editor and realised it would be a great feature for play mode. My question is if there is a convenient way of implementing overdraw mode in game from a press of a custom button.

Would appreciate any help.


Overdraw mode is a diagnostic tool to help you improve performance in your game by identifying those pixels in your scene that are being rendered twice (i.e. where one object is drawn on top of another).

But, if what you want is a shader that produces a similar effect when applied to a material of an object in the scene, then try this:

Shader "Overdraw" {

    Properties { _MainTex ("Base", 2D) = "white" {} }

    SubShader {
      Fog { Mode Off }
      ZWrite Off
      ZTest Always
      Blend One One

      Pass {
        SetTexture[_MainTex] {
          constantColor(0.1, 0.04, 0.02, 0)
          combine constant, texture
      } // End Pass
    } // End Subshader
} // End Shader