文档

Unity Engine

Unity Engine

SupportedOnRenderPipelineAttribute

Set which render pipelines make a class active.
阅读时间4 分钟最后更新于 1 个月前

Definition

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]public class SupportedOnRenderPipelineAttribute : Attribute

Remarks

Add
[SupportedOnRenderPipeline]
above a class to set which Render Pipeline Assets make a class active. For example,
[SupportedOnRenderPipeline(typeof(HDRenderPipelineAsset))
.
[SupportedOnRenderPipeline]
works only with some attributes - for example, CustomEditor. You can use
[SupportedOnRenderPipeline]
without an argument if you want all Scriptable Render Pipeline Assets to make the class active. The following example makes the
BehaviourEditor
class active when any Scriptable Render Pipeline asset is active.
using UnityEditor;using UnityEngine;using UnityEngine.Rendering;[CustomEditor(typeof(Behaviour))][SupportedOnRenderPipeline]public class BehaviourEditor : Editor{ public override void OnInspectorGUI() { EditorGUILayout.LabelField($"{nameof(BehaviourEditor)} is supported on the currently active render pipeline."); }}public class Behaviour : MonoBehaviour{}
Additional Resources: RenderPipelineAsset.

Properties

Property

Description

isSupportedOnCurrentPipelineThe value is
true
if the current
RenderPipelineAsset
supports the attribute.
renderPipelineTypesThe Render Pipeline Assets that support the attribute.

Methods

Method

Description

GetSupportedModeUse
SupportedOnRenderPipelineAttribute.GetSupportedMode
to find out whether a RenderPipelineAsset supports the attribute.

Static Methods

Method

Description

IsTypeSupportedOnRenderPipelineUse this method to determine whether a type has the SupportedOnRenderPipelineAttribute attribute and determine whether a RenderPipelineAsset type supports that attribute.

Enums

Enum

Description

SupportedOnRenderPipelineAttribute.SupportedModeWhether the
RenderPipelineAsset
or its base
RenderPipelineAsset
supports the attribute.

Inheritance

Inherited Members