기억저장고

untiy WebGL 로컬파일(html) 열기 본문

Unity

untiy WebGL 로컬파일(html) 열기

기억해조 2021. 6. 19. 02:39

unity에서 WebGL로 빌드하면 html이 생성되는데 

html을 바로 열려고 하면 서버에 올려야 볼 수있다고 경고창이 나온다 

그때 사용하는방법  2가지... 

 

[방법1] - Chrome 속성변경

1. Chrome 우클릭 > 속성 > 대상 맨뒤에 -allow-file-access-from-files 붙여넣기 후 확인

ex)C:\Program Files\Google\Chrome\Application\chrome.exe" -allow-file-access-from-files 

2. Chrome 창 모두닫은 후 다시 열면 됨 

저렇게 설정해도 가끔씩 안될때가 있는데 

방법 1. 빌드된 html파일 Chrome에 끌어다 넣기

방법 2. 뒤에 붙인거 지우고 확인한다음에 다시 붙여넣고 실행시키기 

이러면 될때가 있다...

 

추천! [방법2] 로컬서버 열기 (정말 쉬움)

1. VisualCode - 확장 - LiveServer 검색 후 설치

2. 빌드된 폴더 자체를, VisualCode에 끌어다 넣기 (+작성자 신뢰합니다 버튼클릭)

3. VisualCode 우측 하단의 GoLive 버튼 클릭

* 서버 종료 하고 싶으면 StopLive(아래이미지처럼 생긴버튼) 누르면됨.

 * GoLive 클릭 시, html 창 자동으로 띄워짐 

 

**만약 하단에 GoLive버튼이 없으면... 원하는 html파일에서

우클릭 - Open with Live Server 클릭

(Stop Live도 마찬가지..)

서버Live: 우클릭-Open with Live Server // 서버Stop : 우클릭-StopLiveServer

 

--

[WebGL 빌드 오류 해결방법 - 1]

유니티 2021버전으로  아무런세팅없이 WebGL빌드 시 아래와 같은 오류가 나올수있는데, CompressionFormat을 Disable로 바꿔줘야한다.

로컬파일 WebGL 오류메시지

 

*해결방법

ProjectSetting - Player - Publishing Settings - Compression Fomat : Disable

단점: 빌드 용량 커짐

CompressionFoamt - Disable

--

[WebGL 빌드 오류 해결방법-2]

CompressionFomat을 GZip으로 빌드 후, http로 접근 시 다음과 같은 오류가 발생할 수 있다

*해결방법

ProjectSetting - Player - Publising Setting - Decompression FallBack 체크!..

 

 

 

 

 

[ CompressionFormat - Disable 출처]

https://forum.unity.com/threads/solved-webgl-build-error-unable-to-parse-build-file-name-framework-js-br.1102759/

 

Help Wanted - [SOLVED] WebGL Build Error - "Unable to parse Build/[File Name].framework.js.br"

THIS POST HAS BEEN SOLVED - FEEL FREE TO DELETE THIS THREAD Since last October I've been having issues with building WebGL files across several...

forum.unity.com

 

[로컬에서 여는방법 출처]

https://m.blog.naver.com/PostView.nhn?blogId=hecki&logNo=30180761926&proxyReferer=https:%2F%2Fwww.google.com%2F

 

Chrome 에서 Local file 로딩 안될 때

Chrome에서는 Local file이 로딩이 안 될 때가 있다. gl.texImage2D 함수에서 Security Error 가 난...

blog.naver.com

 

[CompressionFormat - GZip 출처 ]

https://icode.best/i/57600544933842

 

Unity打包WebGL报Unable to parse Build/*.framework.js.gz This can happen if build compression was.......-爱代码爱编程

Unity版本:2020.3(LTS) 0.错误完整信息: Unable to parse Build/*.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encodi

icode.best

 

Comments