private void OnEnable()
        {
#if URP
            PipelineUtilities.RefreshRendererList();

            renderer = (PlanarReflectionRenderer)target;

            cullingMask     = serializedObject.FindProperty("cullingMask");
            rendererIndex   = serializedObject.FindProperty("rendererIndex");
            offset          = serializedObject.FindProperty("offset");
            includeSkybox   = serializedObject.FindProperty("includeSkybox");
            renderShadows   = serializedObject.FindProperty("renderShadows");
            renderRange     = serializedObject.FindProperty("renderRange");
            renderScale     = serializedObject.FindProperty("renderScale");
            maximumLODLevel = serializedObject.FindProperty("maximumLODLevel");
            waterObjects    = serializedObject.FindProperty("waterObjects");

            if (renderer.waterObjects.Count == 0 && WaterObject.Instances.Count == 1)
            {
                renderer.waterObjects.Add(WaterObject.Instances[0]);
                renderer.RecalculateBounds();
                renderer.EnableMaterialReflectionSampling();

                EditorUtility.SetDirty(target);
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
            }

            ValidateWaterObjectLayer();

            curBounds = renderer.CalculateBounds();
#endif
        }
        /// <summary>
        /// Should the renderer index be changed at runtime, this function must be called to update any reflection cameras
        /// </summary>
        /// <param name="index"></param>
        public void SetRendererIndex(int index)
        {
            index = PipelineUtilities.ValidateRenderer(index);

            foreach (var kvp in reflectionCameras)
            {
                if (kvp.Value == null)
                {
                    continue;
                }

                cameraData = kvp.Value.GetComponent <UniversalAdditionalCameraData>();
                cameraData.SetRenderer(index);
            }
        }
        private void CreateReflectionCamera(Camera source)
        {
            GameObject go = new GameObject(source.name + "_reflection");

            go.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy;
            Camera newCamera = go.AddComponent <Camera>();

            newCamera.hideFlags = HideFlags.DontSave;
            newCamera.CopyFrom(source);
            //Always exclude water layer
            newCamera.cullingMask = ~(1 << 4) & cullingMask;
            //newCamera.cameraType = CameraType.Reflection; //Will cause shadow pass to execute twice?!
            newCamera.depth               = source.depth - 1f;
            newCamera.rect                = new Rect(0, 0, 1, 1);
            newCamera.enabled             = false;
            newCamera.clearFlags          = includeSkybox ? CameraClearFlags.Skybox : CameraClearFlags.Depth;
            newCamera.useOcclusionCulling = false;

            UniversalAdditionalCameraData data = newCamera.gameObject.AddComponent <UniversalAdditionalCameraData>();

            data.requiresDepthTexture = false;
            data.requiresColorTexture = false;
            data.renderShadows        = renderShadows;

            rendererIndex = PipelineUtilities.ValidateRenderer(rendererIndex);
            data.SetRenderer(rendererIndex);

#if RENDER_FEATURE
            cameraLeft.cullingMask = 0;
            data.SetRenderer(1);
            ReflectionRenderers[newCamera] = this;
#endif

            CreateRenderTexture(newCamera, source);

            reflectionCameras[source] = newCamera;
        }