覆盖光照窗口环境部分的 Inspector 的基类。
using UnityEditor; using UnityEditor.Rendering; using UnityEngine; using UnityEngine.Rendering;
[ScriptableRenderPipelineExtension(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 algorythme */} }
class CustomSRPAsset : RenderPipelineAsset { protected override RenderPipeline CreatePipeline() { return new CustomSRP(); } }
在该示例中,当 CustomSRP 正在使用时,将覆盖光照窗口的环境部分。
OnDisable | 当不再使用此 Inspector 覆盖时,将调用 OnDisable。 |
OnEnable | 当使用此 Inspector 覆盖时,将调用 OnEnable。 |
OnInspectorGUI | 绘制光照窗口中的环境部分时调用的回调。 |