using UnityEngine; namespace AQUAS { [AddComponentMenu("AQUAS/Essentials/Depth Support")] public class AQUAS_DepthSupport : MonoBehaviour { public GameObject waterPlane; public LayerMask cullingMask = -1; private void Start() { GameObject gameObject = new GameObject("Depth Cam"); gameObject.transform.SetParent(base.transform, worldPositionStays: false); GameObject gameObject2 = new GameObject("Color Cam"); gameObject2.transform.SetParent(base.transform, worldPositionStays: false); gameObject.hideFlags = HideFlags.HideAndDontSave; gameObject2.hideFlags = HideFlags.HideAndDontSave; Camera camera = gameObject.AddComponent(); Camera camera2 = gameObject2.AddComponent(); camera.CopyFrom(GetComponent()); camera2.CopyFrom(GetComponent()); camera.cullingMask = cullingMask; camera2.cullingMask = cullingMask; camera.cullingMask &= ~(1 << LayerMask.NameToLayer("Water")); camera2.cullingMask &= ~(1 << LayerMask.NameToLayer("Water")); camera.gameObject.AddComponent(); camera2.gameObject.AddComponent(); if (waterPlane == null) { waterPlane = GameObject.Find("Water Plane"); if (waterPlane == null) { return; } } gameObject.AddComponent().plane = waterPlane; gameObject2.AddComponent().plane = waterPlane; } } }