How to make camera render nothing

What I’m after rn is a collider mode where only the colliders of objects are rendered. I already have a script that draws the colliders on screen. But I was wondering what would be the best way to have the camera stop rendering everything else in the scene.

My hacky solution rn is to find all sprite renderers, particle systems etc and disable them. This doesn’t work very well cuz some of my other scripts renable these, and objects that were previously disabled that get enabled later will still have all their sprite renderers unaffected.

So instead of finding and then disabling anything that is usually rendered, I’m looking for some code or setting that would have the camera skip rendering what it normally does. Btw I’m using urp 2D renderer, if that helps.

Any ideas? Thanks.

Have you tried the culling mask? Cameras can be set to include and exclude certain layers, so to make an object ‘invisible’ you could simply set its layer to one that the camera will ignore.

This may not work in your case, for example if you need the layer for collisions and so on, but it’s a thought.

Danny