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.

22 lines
480 B

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