관리되는 코드에서 예외가 발생하는 경우 예외에 대한 스택 추적이 예외의 원인을 파악하는 데 도움이 될 수 있습니다. 그러나 경우에 따라 관리되는 스택 추적이 예상대로 표시되지 않을 수 있습니다. 스택 추적은 빌드 설정에 따라 달라집니다.
C++ Compiler Configuration 프로퍼티를 Debug로 설정하면, IL2CPP는 신뢰할 수 있는 관리되는 스택 추적을 보고하고 각 관리되는 메서드를 호출 스택에 포함합니다. 스택 추적에는 원본 C# 소스 코드의 줄 번호가 포함되지 않습니다.
C++ Compiler Configuration 프로퍼티를 Release 또는 Master로 설정하면, IL2CPP는 관리되는 메서드가 하나 이상 누락된 호출 스택을 생성할 수 있습니다. 이는 C++ 컴파일러가 누락 메서드를 인라이닝할 때 발생합니다. 일반적으로 메서드 인라이닝은 런타임 성능을 향상시키지만, 호출 스택을 이해하기가 더 어려워질 수 있습니다.
IL2CPP는 항상 호출 스택에 관리되는 메서드를 하나 이상 제공합니다. 관리되는 예외에서 생성된 스택 추적의 경우, 이는 예외가 발생한 메서드입니다. 메서드가 인라이닝되지 않은 경우 다른 메서드도 포함됩니다.
관리되는 스택 추적에 파일 및 줄 번호 정보를 포함하려면 Edit > Project Settings > Player > Other Settings로 이동합니다. 그런 다음 Configuration 헤딩에서 IL2CPP Stacktrace Information 프로퍼티를 Method Name, File Name, and Line Number로 설정합니다.
이렇게 설정하면 IL2CPP가 관리되는 모든 스택 프레임을 호출 스택에 포함하도록 지시합니다. 각 스택 프레임에는 해당 코드가 있는 관리되는 어셈블리(.dll)에 대해 관리되는 심볼 파일(.pdb)을 사용할 수 있는 경우 적합한 C# 줄 번호도 포함됩니다.
이 기능을 활성화하면 빌드 시간과 빌드된 프로그램의 최종 크기가 약간 증가합니다. 플레이어 빌드 프로세스에는 디버그 심볼 파일을 처리하고 필요한 심볼 구조가 포함된 새 데이터 파일을 생성하는 추가 단계가 포함됩니다. Unity는 빌드된 플레이어와 함께 이 데이터 파일을 제공하며 런타임에 이 파일을 사용하여 호출 스택의 C# 줄 정보를 확인합니다.
이 기능을 활성화하면 Unity는 인라이닝이 있는 경우에도 Release 또는 Master 설정에서 올바른 호출 스택을 생성합니다.
Script Debugging을 활성화하려면 File > Build Settings로 이동한 다음, Script Debugging 체크박스를 활성화합니다. 스크립트 디버깅이 활성화되면 IL2CPP는 메서드, 파일, 줄 번호와 함께 올바른 관리되는 스택 추적을 보고합니다. 이렇게 하면 프로그램 크기가 커지고 성능이 저하되는 단점이 있습니다.
스택 추적만 개선하려면 스크립트 디버깅을 활성화해서는 안 됩니다. 대신 위에 설명한 대로 소스 코드 줄 번호를 활성화합니다.
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.