Version: 2022.1
언어: 한국어
WebGL에서 입력
WebGL 성능 고려사항

Debug and troubleshoot WebGL builds

Visual Studio doesn’t support debugging Unity WebGL content. Use the following tips to get your build information.

브라우저의 JavaScript 콘솔

Unity WebGL doesn’t have access to your file system, so it doesn’t write a log file like other platforms. However, it does write all logging information such as Debug.Log, Console.WriteLine or Unity’s internal logging to the browser’s JavaScript console.

JavaScript 콘솔을 열려면 다음 단계를 따르십시오.

  • Firefox에서 Windows의 경우 Ctrl-Shift-K를 누르거나 Mac의 경우 Command-Option-K를 누릅니다.
  • Chrome에서 Windows의 경우 Ctrl-Shift-J를 누르거나 Mac의 경우 Command-Option-J를 누릅니다.
  • Safari에서 Preferences > Advanced > Develop로 이동한 후 Command-Option-C를 누릅니다.
  • Microsoft Edge 또는 Internet Explorer에서 F12를 누릅니다.

개발용 빌드

For debugging purposes, you might want to make a development build in Unity (open the Build Settings window and enabled the Development Build checkbox). Development builds allow you to connect the profiler, and Unity doesn’t minify them, so the emitted JavaScript code still contains human-readable (though C++-mangled) function names. The browser uses these to display stack traces if you run into a browser error, when using Debug.LogError, or when an exception occurs and exception support is disabled. Unlike the managed stack traces that can occur when you have full exception support (see below), these stack traces have mangled names, and contain not only managed code, but also the internal UnityEngine code.

예외 지원

WebGL는 여러 예외 지원 수준을 지원합니다(WebGL용 빌드에 관한 문서를 참조). 기본적으로 Unity WebGL은 명시적으로 발생한 예외만 지원합니다. 하지만 Full 예외 지원을 활성화할 수도 있으며, 이 경우 관리되는 코드에서 null 참조와 범위 초과 배열 요소 접근을 찾아내기 위해, IL2CPP 생성 코드를 통해 추가 검사를 진행할 수 있습니다. 이러한 추가 검사 과정은 성능에 큰 악영향을 주고 코드 용량과 로드 시간을 증가시킵니다. 따라서 디버깅 목적으로만 사용하는 것이 좋습니다.

Full 예외 지원에서는 함수 이름을 내보내 관리되는 코드에 대한 스택 트레이스도 생성합니다. 이러한 이유로 탐지되지 않은 예외와 Debug.Log 문의 스택 트레이스가 콘솔에 표시됩니다. 스택 트레이스 문자열을 얻으려면 System.Environment.Stacktrace를 사용하십시오.

문제 해결

문제: 빌드의 메모리 부족

32비트 브라우저에서 흔히 발생하는 문제입니다. WebGL 메모리 문제와 그 해결 방법에 대한 자세한 내용은 WebGL의 메모리를 참조하십시오.

Problem: Files saved to Application.persistentDataPath don’t persist

Unity WebGL는 세션 간에 유지해야 하는 모든 파일(예: PlayerPrefs, 또는 persistentDataPath에 저장된 파일)을 브라우저 IndexedDB에 보관합니다. 이는 비동기 API이므로 완료되는 시점을 알 수 없습니다.

다음 코드를 호출하여 Unity가 모든 보류 중인 파일 시스템 쓰기 작업을 메모리에서 IndexedDB 파일 시스템으로 플러시하십시오.

FS.syncfs(false, function (err) {
  if (err) {
    console.log("Error: syncfs failed!"); 
  }
 });

오류 메시지: 잘못된 헤더 검사

The browser console log usually prints this error due to incorrect server configuration. For more information on how to deploy a release build, see documentation on Deploying compressed builds.

Error message: Decompressing this format (1) isn’t supported on this platform

The browser console log prints this error when the content tries to load an AssetBundle compressed using LZMA, which Unity WebGL doesn’t support. Re-compress the AssetBundle using LZ4 compression to solve this problem. For more information on compression for WebGL, see documentation on WebGL building, particularly the AssetBundles section.


  • 2018.1에서 MonoDevelop는 Visual Studio로 교체됨
WebGL에서 입력
WebGL 성능 고려사항
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961