광원 탐색기 확장 기능을 사용하면 나만의 Light Explorer 창을 만들 수 있습니다. 커스텀 SRP(스크립터블 렌더 파이프라인) 또는 고해상도 렌더 파이프라인의 커스텀 광원과 함께 작동하도록 Light Explorer 창의 기능을 조정하는 데 사용할 수 있습니다.
Light Explorer 창에서 씬의 모든 광원을 확인하고 해당 프로퍼티를 편집할 수 있습니다. 이 확장 기능을 사용하면 현재 창을 여러 가지 방법으로 확장할 수 있습니다. 예를 들어 다음 작업을 수행할 수 있습니다.
광원 탐색기를 확장하려면 다음 중 하나에서 상속받아야 합니다.
ILightingExplorerExtension 인터페이스 및 GetContentTabs 메서드를 오버라이드합니다.ILightingExplorerExtension에서 상속하는 DefaultLightingExplorerExtension 클래스. 이 클래스는 이미 창에 있는 모든 콘텐츠를 제공합니다. 탭 수, 각 탭의 제목, 표시할 광원만 오버라이드하려는 경우에만 사용하십시오. 이렇게 광원 탐색기를 확장하는 방법을 알아보려면 아래 예시를 참조하십시오.이 섹션의 예시에서는 기본 Light Explorer 클래스를 확장하여 광원의 Name 열만 표시하거나 탭 개수를 변경하는 방법을 보여 줍니다. 자체 구현 시 메서드를 원하는 만큼 오버라이드할 수 있습니다.
다음 예제는 광원의 이름 열만 표시합니다.
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
[SupportedOnRenderPipeline(typeof(ExampleRenderPipelineAsset))]
public class SimpleExplorerExtension : DefaultLightingExplorerExtension
{
private static class Styles
{
public static readonly GUIContent Name = EditorGUIUtility.TrTextContent("Name");
}
protected override LightingExplorerTableColumn[] GetLightColumns()
{
return new[]
{
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Name, Styles.Name, null, 200), // 0: Name
};
}
}
다음 예제는 광원의 이름과 활성화된 상태만 보여 주고 Emissive Materials 탭은 숨깁니다(4개가 아니라 3개의 탭만 표시함).
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
[SupportedOnRenderPipeline(typeof(ExampleRenderPipelineAsset))]
public class ComplexLightExplorerExtension : DefaultLightingExplorerExtension
{
private static class Styles
{
public static readonly GUIContent Name = EditorGUIUtility.TrTextContent("Name");
public static readonly GUIContent Enabled = EditorGUIUtility.TrTextContent("Enabled");
}
protected override UnityEngine.Object[] GetLights()
{
return Resources.FindObjectsOfTypeAll<Light>();
}
protected override LightingExplorerTableColumn[] GetLightColumns()
{
return new[]
{
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Name, Styles.Name, null, 200), // 0: Name
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, Styles.Enabled, "m_Enabled", 25), // 1: Enabled
};
}
public override LightingExplorerTab[] GetContentTabs()
{
return new[]
{
new LightingExplorerTab("Lights", GetLights, GetLightColumns, true),
new LightingExplorerTab("2D Lights", Get2DLights, Get2DLightColumns, true),
new LightingExplorerTab("Reflection Probes", GetReflectionProbes, GetReflectionProbeColumns, true),
new LightingExplorerTab("Light Probes", GetLightProbes, GetLightProbeColumns, true),
new LightingExplorerTab("Static Emissives", GetEmissives, GetEmissivesColumns, false),
};
}
}
다음은 광원 탐색기를 확장할 때 사용할 수 있는 클래스 및 메서드 리스트입니다.
ILightingExplorerExtension:
public virtual LightingExplorerTab[] GetContentTabs();
public virtual void OnEnable() {}
public virtual void OnDisable() {}
DefaultLightingExplorerExtension (ILightingExplorerExtension에서 상속함):
public virtual LightingExplorerTab[] GetContentTabs();
public virtual void OnEnable() {}
public virtual void OnDisable() {}
protected virtual UnityEngine.Object[] GetLights();
protected virtual LightingExplorerTableColumn[] GetLightColumns();
protected virtual UnityEngine.Object[] GetReflectionProbes();
protected virtual LightingExplorerTableColumn[] GetReflectionProbeColumns();
protected virtual UnityEngine.Object[] GetLightProbes();
protected virtual LightingExplorerTableColumn[] GetLightProbeColumns();
protected virtual UnityEngine.Object[] GetEmissives();
protected virtual LightingExplorerTableColumn[] GetEmissivesColumns();