public static void SetupDepthBuffer(ref DepthRenderTexture depthRenderTexure, bool enabled, Camera camera, RenderTargetProperty renderTargetProperty)
        {
            if (depthRenderTexure != null)
            {
                depthRenderTexure.Release();
                depthRenderTexure = null;
            }

            if (enabled)
            {
                var targetSize = BackgroundRenderTexture.GetRequiredSize(camera, renderTargetProperty);

#if UNITY_IOS || UNITY_ANDROID
                RenderTextureFormat format = RenderTextureFormat.ARGB32;
#else
                RenderTextureFormat format = (camera.allowHDR) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32;
#endif
                depthRenderTexure = new DepthRenderTexture(targetSize.x, targetSize.y, renderTargetProperty);

                // HACK for some smart phone
                if (depthRenderTexure == null || !depthRenderTexure.Create())
                {
                    depthRenderTexure = null;
                }
            }
        }
            public void Dispose()
            {
                if (this.commandBuffer != null && !isCommandBufferFromExternal)
                {
                    if (this.camera != null)
                    {
                        this.camera.RemoveCommandBuffer(this.cameraEvent, this.commandBuffer);
                    }
                    this.commandBuffer.Dispose();
                    this.commandBuffer = null;
                }

                if (this.renderTexture != null)
                {
                    this.renderTexture.Release();
                    this.renderTexture = null;
                }

                if (depthTexture != null)
                {
                    depthTexture.Release();
                    depthTexture = null;
                }
            }