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

ICustomLightEditor

interface in UnityEditor.Experimental

Switch to Manual

Description

Custom light inspector class for a RenderPipelineAsset.

When writing a Scriptable Render Pipeline, you do not always want to use default editor for the lights. For example; the render pipeline might not support LightLayers. You can extend this interface in conjunction with the CustomLightEditorAttribute to enable custom Light editor rendering. See Also: 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>(); } } } }

Public Functions

OnInspectorGUIImplement this function to make a custom light inspector.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961