using System.Collections; using System.Collections.Generic; using UnityEngine; public class BFX_RenderDepth : MonoBehaviour { DepthTextureMode defaultMode; void OnEnable() { var cam = GetComponent(); defaultMode = cam.depthTextureMode; if (cam.renderingPath == RenderingPath.Forward) { cam.depthTextureMode |= DepthTextureMode.Depth; } } // Update is called once per frame void OnDisable() { GetComponent().depthTextureMode = defaultMode; } }