Legacy Documentation: Version 2017.2 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

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

ICustomLightEditor

interface in UnityEditor.Experimental

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

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.

no example available in JavaScript
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 Methods

OnInspectorGUIImplement this function to make a custom light inspector.
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答