用于检视器的基类,用于覆盖照明窗口的“环境”部分。
using UnityEditor; using UnityEngine; using UnityEngine.Rendering;
[SupportedOnRenderPipeline(typeof(CustomSRPAsset))] class CustomEnvironmentSection : LightingWindowEnvironmentSection { public override void OnInspectorGUI() { // The following will be displayed instead of the Environment section in the LightingWindow EditorGUILayout.LabelField("My Custom Environment Section !!"); } }
//Below is a custom empty render pipeline only here for explaining the filtering in ScriptableRenderPipelineExtension
class CustomSRP : RenderPipeline { protected override void Render(ScriptableRenderContext context, Camera[] cameras) { /* My custom rendering algorithm */ } }
class CustomSRPAsset : RenderPipelineAsset { protected override RenderPipeline CreatePipeline() { return new CustomSRP(); } }
在本例中,当使用 CustomSRP 时,会覆盖照明窗口的“环境”部分。
OnDisable | 当不再使用此检视器覆盖时,将调用 OnDisable。 |
OnEnable | 当使用此检视器覆盖时,将调用 OnEnable。 |
OnInspectorGUI | 在照明窗口中绘制“环境”部分时调用的回调函数。 |