interface in UnityEditor.Experimental
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>(); } } } }
OnInspectorGUI | Implement this function to make a custom light inspector. |