- Home /
Depth Buffer materials in Scene View
"We have some materials that are reliant of a depth buffer to render properly. It's necessary for the artists/designers to see these materials in the scene view, but I'm not finding a way to force the scene view camera to render a depth buffer. Setting it's depthTextureMode seems ineffective. Any ideas?"
Answer by Aras · Jan 14, 2010 at 12:13 PM
I'm afraid currently (Unity 2.6.1) scene view's camera does not render the depth/depthnormals texture.
I will have this fixed for a future Unity release, but that won't happen very soon I think.
4 years later, Unity 4.5.4f1 - still no depth texture for the scene view camera?
I tried the following but didn't get any results:
using UnityEngine;
using UnityEditor;
using System.Collections;
[ExecuteInEdit$$anonymous$$ode]
public class EnableSceneViewCameraDepthTexture : $$anonymous$$onoBehaviour
{
void OnDrawGizmo()
{
#if UNITY_EDITOR
if (SceneView.lastActiveSceneView.camera.depthTexture$$anonymous$$ode == DepthTexture$$anonymous$$ode.None)
{
SceneView.lastActiveSceneView.camera.depthTexture$$anonymous$$ode = DepthTexture$$anonymous$$ode.Depth;
}
#endif
}
}
$$anonymous$$arco Sperling's code works fine!!! Except One Tiny Spelling Error: OnDrawGizmo ==> OnDrawGizmos
Your answer
![](https://koobas.hobune.stream/wayback/20220611232458im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scene View Camera Depth Texture? 0 Answers
Select object by selecting gizmo or handle? 1 Answer
Scene tab goes weird 2 Answers
Scene view keeps jumping to the side during navigation 0 Answers
Adjusting the scene view camera speed/acceleration 0 Answers