diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Stripping/RenderPipelineGraphicsSettingsStripper.cs b/Packages/com.unity.render-pipelines.core/Runtime/Stripping/RenderPipelineGraphicsSettingsStripper.cs index 7e47776967c..cca8b482931 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Stripping/RenderPipelineGraphicsSettingsStripper.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Stripping/RenderPipelineGraphicsSettingsStripper.cs @@ -10,6 +10,9 @@ internal static partial class RenderPipelineGraphicsSettingsStripper { private static bool CanRemoveSettings(this List strippers, [DisallowNull] Type settingsType, [DisallowNull] IRenderPipelineGraphicsSettings settings) { + if (strippers == null) + return false; + const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; var canRemoveSettings = true; @@ -18,7 +21,7 @@ private static bool CanRemoveSettings(this List strippers, [DisallowN foreach (var stripperInstance in strippers) { - var methodInfo = stripperInstance.GetType().GetMethod($"{nameof(IRenderPipelineGraphicsSettingsStripper.CanRemoveSettings)}", flags); + var methodInfo = stripperInstance?.GetType().GetMethod($"{nameof(IRenderPipelineGraphicsSettingsStripper.CanRemoveSettings)}", flags); if (methodInfo != null) canRemoveSettings &= (bool)methodInfo.Invoke(stripperInstance, methodArgs); } @@ -36,8 +39,7 @@ private static bool CanTransferSettingsToPlayer( strippersDefined = false; var settingsType = settings.GetType(); - - if (strippersMap.TryGetValue(settingsType, out var strippers)) + if (strippersMap.TryGetValue(settingsType, out var strippers) && strippers != null) { if (!strippers.CanRemoveSettings(settingsType, settings)) isAvailableOnPlayerBuild = true; @@ -80,7 +82,7 @@ public static void PerformStripping( report.AddStrippedSetting(settings.GetType(), isAvailableOnPlayerBuild, strippersDefined); } } - + } } }