Version: 2023.1

SupportedOnRenderPipelineAttribute

class in UnityEngine.Rendering

切换到手册

描述

Set which render pipelines make a class active.

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 { }

See Also: RenderPipelineAsset.

变量

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

公共函数

GetSupportedModeUse SupportedOnRenderPipelineAttribute.GetSupportedMode to find out whether a RenderPipelineAsset supports the attribute.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961