public static void AddProjector(ProjectorForLWRP projector, Camera camera) { #if UNITY_EDITOR // check if the current Forward Renderer has the ProjectorRendererFeature instance. LightweightRenderPipelineAsset renderPipelineAsset = UnityEngine.Rendering.LWRP.LightweightRenderPipeline.asset; if (renderPipelineAsset == null) { return; } UnityEditor.SerializedObject serializedObject = new UnityEditor.SerializedObject(renderPipelineAsset); UnityEditor.SerializedProperty rendererDataProperty = serializedObject.FindProperty("m_RendererData"); UnityEngine.Rendering.LWRP.ScriptableRendererData rendererData = rendererDataProperty.objectReferenceValue as UnityEngine.Rendering.LWRP.ScriptableRendererData; if (rendererData == null) { Debug.LogError("The current Lightweight Render Pipeline Asset does not have Forward Renderer Data! Please set a Forward Renderer Data which contains ProjectorRendererFeature to the current render pipeline asset.", renderPipelineAsset); } else { bool found = false; foreach (var rendererFeature in rendererData.rendererFeatures) { if (rendererFeature is ProjectorRendererFeature) { found = true; break; } } if (!found) { Debug.LogError("ProjectorRendererFeature is not added to the current Forward Renderer Data.", rendererData); } } #endif if (s_projectorPasses == null) { #if UNITY_EDITOR Debug.LogError("No ProjectorRendererFeature instances are created!"); #endif return; } AddProjectorInternal(projector, camera); }