Version: 2017.2
Experimental: this API is experimental and might be changed or removed in the future.

ICustomLightEditor

interface in UnityEditor.Experimental

切换到手册

描述

自定义 RenderPipelineAsset 的光照检视面板类。

编写可编程渲染管线时,您不需要一直使用光照的默认编辑器。例如,渲染管线可能并不支持 LightLayers。您可以将此界面与 CustomLightEditorAttribute 共同扩展,以启用自定义光照编辑器渲染。 另请参阅:CustomLightEditorAttributeLightEditor

using UnityEditor;
using UnityEditor.Experimental;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;

// This is a custom Light Editor for the HDPipeline [CustomLightEditor(typeof(HDRenderPipeline))] public class LightEditor : ICustomLightEditor { public void OnInspectorGUI(UnityEditor.LightEditor lightEditor) { // Draw the default light editor UI lightEditor.DefaultOnInspectorGUI();

var light = lightEditor.target as Light; var additionalData = light.GetComponent<AdditionalLightData>();

// if there is no additional light data // add an option to create it. if (additionalData == null) { if(GUILayout.Button("Add additional light Data")) { light.gameObject.AddComponent<AdditionalLightData>(); } } } }

公共函数

OnInspectorGUI实现此函数以创建自定义光照检视面板。
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961