Visual Studio는 Unity WebGL 콘텐츠 디버깅을 지원하지 않습니다.빌드 정보를 얻으려면 다음 팁을 사용하십시오.
Unity WebGL은 파일 시스템에 액세스할 수 없으므로 다른 플랫폼처럼 로그 파일을 작성하지 않습니다.하지만 모든 로깅 정보(Debug.Log
, Console.WriteLine
또는 Unity의 내부 로깅 등)를 브라우저의 JavaScript 콘솔에 작성합니다.
JavaScript 콘솔을 열려면 다음 단계를 따르십시오.
디버깅 목적으로는 Unity에서 개발용 빌드를 만드는 것이 좋습니다(Build Settings 창을 열고 Development Build 체크박스 선택). 개발용 빌드는 프로파일러에 연결할 수 있으며 Unity에서 최소화되지 않습니다. 따라서 출력되는 JavaScript 코드는 사람이 읽을 수 있는 C++-mangled 함수 이름을 포함합니다.
이를 통해 브라우저는 브라우저 오류가 발생하거나, Debug.LogError
를 사용하거나, 예외 지원이 비활성화된 상태에서 예외가 발생하는 경우 스택 추적을 표시할 수 있습니다. 전체 예외를 지원할 때 발생할 수 있는 관리되는 스택 추적과 달리 이러한 스택 추적은 이름이 뒤섞여 있으며 관리되는 코드뿐만 아니라 내부 UnityEngine 코드도 포함됩니다.
WebGL has different levels of exception support, but by default, Unity WebGL only supports explicitly thrown exceptions. For more information, refer to Build your WebGL application. You can enable Full exception support, which emits additional checks in the IL2CPP-generated code, to catch access to null references and out-of-bounds array elements in your managed code. These additional checks significantly impact performance and increase code size and load times, so you must only use it for debugging.
Full 예외 지원에서는 함수 이름을 내보내 관리되는 코드에 대한 스택 트레이스도 생성합니다. 이러한 이유로 탐지되지 않은 예외와 Debug.Log
문의 스택 트레이스가 콘솔에 표시됩니다. 스택 트레이스 문자열을 얻으려면 System.Environment.Stacktrace
를 사용하십시오.
This is a common problem, especially on 32-bit browsers. For more information on WebGL memory issues and how to fix them, refer to the documentation on Memory in Unity WebGL.
브라우저 콘솔 로그는 보통 이러한 오류를 잘못된 서버 설정의 결과로 출력합니다.릴리스 빌드를 배포하는 방법에 대한 자세한 내용은 압축된 빌드 배포에 관한 문서를 참조하십시오.
콘텐츠가 Unity WebGL에서 지원하지 않는 LZMA 압축 방식으로 압축된 에셋 번들을 로드하려고 시도하면 브라우저 콘솔 로그가 이러한 오류를 출력합니다.LZ4 압축 방식으로 에셋 번들을 다시 압축하면 이 문제를 해결할 수 있습니다.WebGL의 압축에 관한 자세한 내용은 WebGL 빌드 문서의 에셋 번들 섹션을 참조하십시오.
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.