UnityGame/Library/PackageCache/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/RendererStripper.cs
2024-10-27 10:53:47 +03:00

30 lines
1.1 KiB
C#

using UnityEditor.Rendering.Universal;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering
{
abstract class RendererStripper<T, S> : IRenderPipelineGraphicsSettingsStripper<T>
where T : IRenderPipelineGraphicsSettings
where S : ScriptableRendererData
{
public bool active => URPBuildData.instance.buildingPlayerForUniversalRenderPipeline;
public bool CanRemoveSettings(T settings)
{
foreach (var urpAssetForBuild in URPBuildData.instance.renderPipelineAssets)
{
// UUM-57954: Use RendererData rather than Renderer which may be null during the build in some circumstances
foreach(var rendererData in urpAssetForBuild.m_RendererDataList)
if (rendererData is S)
return false;
}
return true;
}
}
class UniversalRendererResourcesStripper : RendererStripper<UniversalRendererResources, UniversalRendererData> { }
class Renderer2DResourcesStripper : RendererStripper<Renderer2DResources, Renderer2DData> { }
}