static void Initialize() { _instance = new SRPSupport(); if (_instance.UsingCustomRenderPipeline()) { CaptureCamera.SRPSupport = _instance; Manager.Instance.StartNotification += () => { RenderPipelineManager.endFrameRendering += (ScriptableRenderContext context, Camera[] cameras) => { foreach (var camera in cameras) { if (Application.isPlaying && _instance._pendingCameraRequests.ContainsKey(camera)) { var pendingRequests = _instance._pendingCameraRequests[camera].ToArray(); _instance._pendingCameraRequests[camera].Clear(); foreach (var r in pendingRequests) { r.data.colorFunctor?.Invoke(r); r.data.depthFunctor?.Invoke(r); r.data.motionVectorsFunctor?.Invoke(r); } } } }; }; } }
static void Initialize() { if (SRPSupport.UsingCustomRenderPipeline()) { instance = new SRPSupport(); if (CaptureCamera.SRPSupport == null) { CaptureCamera.SRPSupport = instance; } Manager.Instance.StartNotification += () => { #if URP_ENABLED instance.URPSetupCustomPasses(); #endif #if HDRP_ENABLED instance.HDRPSetupCustomPasses(); #endif RenderPipelineManager.endCameraRendering += SRPSupport.instance.EndCameraRendering; }; Manager.Instance.ShutdownNotification += () => { RenderPipelineManager.endCameraRendering -= SRPSupport.instance.EndCameraRendering; #if URP_ENABLED if (instance._addedRendererFeature && instance._URPRendererFeature != null) { instance.RemoveRendererFeatureIfPresent(instance._URPRendererFeature); } #endif }; } }