You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
557 B
C#

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