Debugger Component
Overview
디버거 컴포넌트는 Unity Game Framework 애플리케이션을 위한 인게임 디버깅 인터페이스를 제공합니다.
게임 실행 중 외부 툴 없이 FPS, 메모리 사용량, 시스템 상태, 로그 등을 실시간으로 확인하고 문제를 분석할 수 있습니다.
GUI는 작은 아이콘 모드와 전체 창 모드로 전환할 수 있습니다.
Features and Capabilities
디버거 컴포넌트는 여러 디버깅 창을 그룹별로 제공합니다.
그룹 | 창 | 목적 |
Console | Console | 로그, 경고, 오류, 예외 표시 |
Information | System, Environment, Screen, Graphics, Input, Path, Scene, Time, Quality | 게임 환경 상세 정보 표시 |
Profiler | Summary, Memory, Object Pool, Reference Pool, Network | 성능 지표와 메모리 사용량 표시 |
Other | Settings, Operations | 설정 옵션과 런타임 작업 제공 |
Window Modes
두 가지 모드를 지원합니다.
•
Icon Mode: 작은 FPS 카운터, 로그 심각도에 따라 색상 변경
•
Full Window Mode: 탭 기반의 전체 창 인터페이스
Component Integration
디버거 컴포넌트는 다른 프레임워크 컴포넌트와 연동하여 해당 상태를 표시합니다.
Configuration
Activation Modes
활성화 모드는 다음과 같이 설정할 수 있습니다.
모드 | 설명 |
AlwaysOpen | 빌드 타입과 관계없이 항상 활성화 |
OnlyOpenWhenDevelopment | 개발 빌드에서만 활성화 |
OnlyOpenInEditor | Unity Editor에서만 활성화 |
AlwaysClose | 항상 비활성화 |
설정은 인스펙터의 m_ActiveWindow 필드에서 제어됩니다.
Window Customization
다음 속성을 통해 창을 커스터마이즈할 수 있습니다.
•
WindowRect : 창 위치 및 크기
•
IconRect : 아이콘 위치
•
WindowScale : 창 스케일
ResetLayout() 메서드로 기본값으로 초기화할 수 있습니다.
Initialization and Registration
디버거 컴포넌트는 Awake/Start 단계에서 자동 초기화되며 기본 디버깅 창을 등록합니다.
Window Registration and Management
•
RegisterDebuggerWindow(path, window, args) : 새로운 창 등록
•
UnregisterDebuggerWindow(path) : 창 제거
•
GetDebuggerWindow(path) : 창 가져오기
•
SelectDebuggerWindow(path) : 창 활성화
창 경로는 "Information/System"과 같은 계층 구조를 사용합니다.
Console Features
콘솔 창은 Unity 로그를 캡처하고 다음 기능을 제공합니다.
•
로그 심각도별 색상 구분
•
로그 필터링
•
로그 히스토리 탐색
•
클립보드 복사
API 예시:
•
GetRecentLogs(results) → 모든 로그 가져오기
•
GetRecentLogs(results, count) → 최근 N개 로그 가져오기
Usage Examples
// 디버거 컴포넌트 접근
DebuggerComponent debugger = GameEntry.GetComponent<DebuggerComponent>();
debugger.ActiveWindow = true;
debugger.ShowFullWindow = true;
debugger.SelectDebuggerWindow("Profiler/Memory/Summary");
C#
복사
// 커스텀 디버거 창 등록
public class MyCustomDebuggerWindow : IDebuggerWindow
{
public void Initialize(params object[] args) { }
public void Shutdown() { }
public void OnEnter() { }
public void OnLeave() { }
public void OnUpdate(float elapseSeconds, float realElapseSeconds) { }
public void OnDraw() { /* UI 내용 작성 */ }
}
GameEntry.GetComponent<DebuggerComponent>()
.RegisterDebuggerWindow("Custom/MyWindow", new MyCustomDebuggerWindow());
C#
복사
Best Practices
•
성능 오버헤드가 있으므로 릴리즈 빌드에서는 제한적으로 사용
•
커스텀 창의 OnDraw()는 가볍게 구현
•
창 위치·크기는 저장/복원하여 UX 개선
•
창 경로는 "MySystem/Status" 같은 계층 구조 사용