Shader working in game, but not showing in editor

I’m pretty new to writing shaders in HLSL, and after some trial and error I got a color replacement shader working. It just turns red pixels black when a bool is set to true. It works perfectly fine in the game view.

I would like to have the shader to work in edit mode, but I can’t get it to work.

The shader is added to the camera via a C# script:

[ExecuteInEditMode]
public class ShaderHandler : MonoBehaviour
{
    public Material material;

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Graphics.Blit(source, destination, material);
    }
}

Is there a way to get OnRenderImage to run in edit mode? I’m using the standard render pipeline.

Great, so no one knows?

[ImageEffectAllowedInSceneView]

1 Like

Thank you so much, it now works! After adding this attribute I had to close and reopen the scene view to make it work though.