Version: 2021.3
언어: 한국어
광원 탐색기 창
라이트매핑

광원 탐색기 확장자

광원 탐색기 확장을 사용하면 커스텀 버전의 광원 탐색기 창을 만들 수 있습니다. 이 확장을 사용하면 Light Explorer 창의 기능을 조정하여 커스텀 스크립터블 렌더 파이프라인(SRP), 또는 고해상도 렌더 파이프라인의 커스텀 광원에 사용할 수 있습니다.

Light Explorer 창에서는 씬의 모든 광원을 확인하고 해당 프로퍼티를 편집할 수 있습니다. 이 확장을 통해 현재 창을 여러 방법으로 확장할 수 있습니다. 다음 예를 참조하십시오.

  • 단순히 탭 이름을 변경하거나 다른 타입의 게임 오브젝트를 표시하는 커스텀 탭을 추가하는 등 탭을 변경합니다. 예를 들어 커스텀 반사 프로브에 대한 프로퍼티 정보를 표시할 때 특히 유용합니다.
  • 이름을 바꾸거나 커스텀 열을 추가하는 등 탭의 열을 변경합니다. 열을 추가하면 추가 광원 프로퍼티를 편리하게 확인할 수 있습니다.

광원 탐색기 확장

광원 탐색기를 확장하려면 다음 중 하나에서 상속받아야 합니다.

  • ILightingExplorerExtension 인터페이스. GetContentTabs 메서드를 오버라이드합니다.
  • ILightingExplorerExtension에서 상속되는 DefaultLightingExplorerExtension 클래스. 이 클래스는 이미 창에 있는 모든 콘텐츠를 제공합니다. 이 클래스를 사용하면 탭 개수, 각 탭의 제목, 표시할 광원 등을 오버라이드할 수 있습니다. 광원 탐색기를 이런 식으로 확장하는 방법을 알아보려면 아래 예제를 참조하십시오.

예제 코드

이 섹션의 예제는 기본 광원 탐색기 클래스를 확장하여 광원의 이름 열만 표시하거나 탭 개수를 변경하는 방법을 보여줍니다. 자체 구현 시 원하는 수의 메서드를 오버라이드할 수 있습니다.

다음 예제는 광원의 이름 열만 표시합니다.

using UnityEngine;
using UnityEditor;

[LightingExplorerExtensionAttribute(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 UnityEditor;

[LightingExplorerExtensionAttribute(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();

  • 2019–08–13 페이지 게시됨
  • [2018.3]에서 광원 탐색기 확장자 추가됨(https://docs.unity.cn/2018.3/Documentation/Manual/30_search.html?q=newin20183) NewIn20183
광원 탐색기 창
라이트매핑
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961