Version: 2022.1
언어: 한국어
Windows 런타임 지원
스크립팅 제약

IL2CPP로 관리되는 스택 추적

관리되는 코드에 예외가 발생하면 예외의 원인을 파악하는 데 예외에 대한 스택 추적이 도움될 수 있습니다.이는 종종 플레이어 로그 파일에서 찾을 수 있습니다.하지만 스택 추적은 빌드 설정에 따라 달라지므로 관리되는 스택 추적이 예상한 대로 표시되지 않을 수 있습니다.

C++ Compiler Configuration 옵션

Debug

C# Compiler Configuration이 Debug로 설정되어 있으면 IL2CPP는 신뢰할 수 있고 관리되는 스택 추적을 보고하고 관리되는 각 메서드를 호출 스택에 포함합니다.스택 추적에는 원본 C# 소스 코드의 줄 번호가 포함되지 않습니다.

Release 및 Master

C++ Compiler Configuration이 Release 또는 Master로 설정되어 있으면 IL2CPP는 관리되는 메서드가 하나 이상 누락된 호출 스택을 생성할 수 있습니다.이는 C++ 컴파일러가 누락된 메서드를 인라이닝했기 때문입니다.메서드를 인라이닝하면 일반적으로 런타임에 성능을 높이는 데 유리하지만, 호출 스택을 파악하기 더 어려워질 수 있습니다.IL2CPP는 항상 호출 스택에서 관리되는 메서드를 하나 이상 제공합니다.관리되는 예외에서 생성된 스택 추적의 경우, 이 메서드는 예외가 발생한 메서드입니다.인라이닝되지 않은 경우 다른 메서드도 포함합니다.

소스 코드 줄 번호

To locate errors that the compiler finds in your code, you can configure the managed stack trace information to include the file name and line number in the managed stack traces. The managed stack trace information does not include this information by default, because it increases code size and causes the Unity Player to run more slowly.

Note: The option to include line numbers in the stack trace is only available on desktop platforms.

To configure the managed stack trace information to include the file name and line numbers:

  1. Edit > Project Settings > Player > Other Settings로 이동합니다.
  2. Set IL2CPP Stacktrace Information to Method Name, File Name, and Line Number.

Note: When the C++ Compiler Configuration is set to Release or Master, you might experience the following:

  • The compiler might inline some functions, which causes them not to appear in the stack trace.
  • The source code line numbers might not match up with the correct line numbers in your code.

Script Debugging enabled

To enable Script Debugging, go to File > Build Settings then click the checkbox next to Script Debugging. With Script Debugging enabled, IL2CPP will always report a correct managed stack trace with the method, file name, and line number. However, this increases the program size and produces slower code. Using script debugging solely to improve stack traces is not recommended. Instead, enable the option shown above.

Windows 런타임 지원
스크립팅 제약