광원 탐색기 확장을 사용하면 커스텀 버전의 광원 탐색기 창을 만들 수 있습니다. 이 확장을 사용하면 Light Explorer 창의 기능을 조정하여 커스텀 스크립터블 렌더 파이프라인(SRP), 또는 고해상도 렌더 파이프라인의 커스텀 광원에 사용할 수 있습니다.
Light Explorer 창에서는 씬의 모든 광원을 확인하고 해당 프로퍼티를 편집할 수 있습니다. 이 확장을 통해 현재 창을 여러 방법으로 확장할 수 있습니다. 다음 예를 참조하십시오.
광원 탐색기를 확장하려면 다음 중 하나에서 상속받아야 합니다.
ILightingExplorerExtension
인터페이스. GetContentTabs
메서드를 오버라이드합니다.ILightingExplorerExtension
에서 상속되는 DefaultLightingExplorerExtension
클래스. 이 클래스는 이미 창에 있는 모든 콘텐츠를 제공합니다. 이 클래스를 사용하면 탭 개수, 각 탭의 제목, 표시할 광원 등을 오버라이드할 수 있습니다. 광원 탐색기를 이런 식으로 확장하는 방법을 알아보려면 아래 예제를 참조하십시오.이 섹션의 예제는 기본 광원 탐색기 클래스를 확장하여 광원의 이름 열만 표시하거나 탭 개수를 변경하는 방법을 보여줍니다. 자체 구현 시 원하는 수의 메서드를 오버라이드할 수 있습니다.
다음 예제는 광원의 이름 열만 표시합니다.
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 (inherit from 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();
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.