interface in UnityEditor.Experimental
自定义 RenderPipelineAsset 的光照检视面板类。
编写可编程渲染管线时,您不需要一直使用光照的默认编辑器。例如,渲染管线可能并不支持 LightLayers。您可以将此界面与 CustomLightEditorAttribute 共同扩展,以启用自定义光照编辑器渲染。 另请参阅:CustomLightEditorAttribute、LightEditor。
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 | 实现此函数以创建自定义光照检视面板。 |