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

19 lines
448 B

  1. // Attach this script to your camera in order to use depth nodes in forward rendering
  2. using UnityEngine;
  3. [RequireComponent(typeof(Camera))]
  4. public class EnableCameraDepthInForward : MonoBehaviour {
  5. #if UNITY_EDITOR
  6. void OnDrawGizmos(){
  7. Set();
  8. }
  9. #endif
  10. void Start () {
  11. Set();
  12. }
  13. void Set(){
  14. if(GetComponent<Camera>().depthTextureMode == DepthTextureMode.None)
  15. GetComponent<Camera>().depthTextureMode = DepthTextureMode.Depth;
  16. }
  17. }