Unity-Technologies/UnityCsReference · error · ArgumentException

Given rpAssetType must derive from RenderPipelineAsset

Error message

Given rpAssetType must derive from RenderPipelineAsset

What it means

Thrown by the ScriptableRenderPipelineExtensionAttribute constructor when the supplied rpAssetType is null or not a subclass of RenderPipelineAsset. The attribute (now deprecated) requires a concrete render pipeline asset type.

Source

Thrown at Editor/Mono/Inspector/ScriptableRenderPipelineExtensionAttribute.deprecated.cs:19

// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License

using System;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering;

[Obsolete($"{nameof(ScriptableRenderPipelineExtensionAttribute)} is deprecated. Use {nameof(SupportedOnRenderPipelineAttribute)} instead. #from(23.1) (UnityUpgradable) -> UnityEngine.Rendering.SupportedOnRenderPipelineAttribute", false)]
[AttributeUsage(AttributeTargets.Class)]
public class ScriptableRenderPipelineExtensionAttribute : Attribute
{
    internal Type renderPipelineType;

    public ScriptableRenderPipelineExtensionAttribute(Type rpAssetType)
    {
        if (!(rpAssetType?.IsSubclassOf(typeof(RenderPipelineAsset)) ?? false))
            throw new ArgumentException($"Given {nameof(rpAssetType)} must derive from {nameof(RenderPipelineAsset)}");
        renderPipelineType = rpAssetType;
    }

    [Obsolete($"ScriptableRenderPipelineExtensionAttribute.inUse is deprecated. Use SupportedOnRenderPipelineAttribute.isSupportedOnCurrentPipeline instead. #from(23.1) (UnityUpgradable) -> UnityEngine.Rendering.SupportedOnRenderPipelineAttribute.isSupportedOnCurrentPipeline", false)]
    public bool inUse
        => GraphicsSettings.currentRenderPipelineAssetType == renderPipelineType;
}

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Pass a type that derives from RenderPipelineAsset (e.g. typeof(UniversalRenderPipelineAsset)).
  2. Migrate to the replacement SupportedOnRenderPipelineAttribute per the deprecation message.
  3. Verify rpAssetType?.IsSubclassOf(typeof(RenderPipelineAsset)) before applying the attribute.

Example fix

// before
[ScriptableRenderPipelineExtension(typeof(UniversalRenderPipeline))]
class MyFeature {}

// after
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
class MyFeature {}
Defensive patterns

Strategy: type-guard

Validate before calling

bool ok = rpAssetType != null && rpAssetType.IsSubclassOf(typeof(RenderPipelineAsset));

Type guard

static bool IsValidRpAssetType(Type t) => t?.IsSubclassOf(typeof(RenderPipelineAsset)) ?? false;

Prevention

When it happens

Trigger: Decorating a class with [ScriptableRenderPipelineExtension(typeof(SomeType))] where SomeType does not derive from RenderPipelineAsset. Passing an interface, abstract base, or unrelated type.

Common situations: Mistaking the render pipeline type for the asset type. Passing typeof(RenderPipeline) instead of typeof(RenderPipelineAsset). Migration from the deprecated attribute where the type argument was wrong.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/023f5d1e4f5cb730. Report an issue: GitHub.