前提・実現したいこと
最終的な目標は、UnityのWebGLから、動画ファイルをダウンロードすることです。
まず最初の段階として、画像ファイルをダウンロードすることから取り組もうとしています。
https://junk-box.net/kuyo/index.php/2019/11/24/panorama-dl/
こちらのサイトにあるように、UNITYのWebGLコンテンツから画像をダウンロードすることを実装したいです。
実際に取り組んでみると、ビルド時にエラーが発生してしまいました。(サイトの著者も現在のバージョンではエラーが発生すると記載がありました)
StandaloneFileBrowserは使わない方法で解決したいです。(StandaloneFileBrowser以外の方法でUNITYのWebGLコンテンツから画像をダウンロードする方法があるのならば、教えていただけると助かります。)
発生している問題・エラーメッセージ
非常に見づらくなってしまいますが、エラーを全て記載しておきます。(一部省略しました)
Failed running python -E "/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc" @"/Users/aguroshou/Downloads/FileDownloadFromWebglTestUnityProject/Assets/../Temp/emcc_arguments.resp" stdout: stderr:error: failure to execute js library "/Users/aguroshou/Downloads/FileDownloadFromWebglTestUnityProject/Assets/Plugins/WebGL/FileDownload.jslib": SyntaxError: Invalid or unexpected token,,SyntaxError: Invalid or unexpected token at Object.load (eval at globalEval (/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/compiler.js:105:8), <anonymous>:179:14) at JSify (eval at globalEval (/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/compiler.js:105:8), <anonymous>:87:20) at /Users/aguroshou/Downloads/FileDownloadFromWebglTestUnityProject/Assets/Plugins/WebGL/FileDownload.jslib (/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/compiler.js:221:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7)preprocessed source (you can run a js engine on this to get a clearer error message sometimes):============={\rtf1\ansi\ansicpg932\cocoartf2513\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 Monaco;}{\colortbl;\red255\green255\blue255;\red10\green82\blue135;\red255\green255\blue255;}{*\expandedcolortbl;;\cssrgb\c0\c40000\c60000;\cssrgb\c100000\c100000\c100000;}\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0\deftab720\pard\pardeftab720\partightenfactor0\f0\fs32 \cf2 \cb3 \expnd0\expndtw0\kerning0var FileDownloadPlugin = \{\ FileDownLoad: function(pImage , size, pStr) \{\ var mimeType = 'data:image/png;base64';\ var filename = Pointer_stringify(pStr);\ var binary = new ArrayBuffer(size);\ var dv = new DataView(binary);\ \ for (var i = 0; i < size; i++)\ dv.setUint8(i, HEAPU8[pImage + i]);\ var blob = new Blob([binary], \{type : mimeType\});\ const a = document.createElement('a');\ a.href = window.URL.createObjectURL(blob);\ a.download = filename;\ a.style.display = 'none';\ document.body.appendChild(a);\ a.click();\ document.body.removeChild(a);\ \}\}\mergeInto(LibraryManager.library, FileDownloadPlugin);\}=============Internal compiler error in src/compiler.js! Please raise a bug report at https://github.com/kripken/emscripten/issues/ with a log of the build and the input files used to run. Exception message: "SyntaxError: Invalid or unexpected token" | SyntaxError: Invalid or unexpected token at Object.load (eval at globalEval (一部省略) "/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py", line 541, in compile_settings cwd=path_from_root('src'), error_limit=300) File "/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/tools/jsrun.py", line 132, in run_js raise Exception('Expected the command ' + str(command) + ' to finish with return code ' + str(assert_returncode) + ', but it returned with code ' + str(proc.returncode) + ' instead! Output: ' + str(ret)[:error_limit])Exception: Expected the command ['/Applications/Unity/Hub/Editor/2019.4.2f1/Unity.app/Contents/Tools/nodejs/bin/node', '--stack_size=8192', '--max-old-space-size=4096', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/compiler.js', '/tmp/tmpchXiGI.txt', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Audio.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Cursor.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Eval.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/FileSystem.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Logging.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Profiler.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/SystemInfo.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/UnetWebSocket.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Video.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/WebCam.js', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/lib/WebRequest.js', '/Users/aguroshou/Downloads/FileDownloadFromWebglTestUnityProject/Assets/Plugins/WebGL/FileDownload.jslib', '/Applications/Unity/Hub/Editor/2019.4.2f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/library_pthread_stub.js'] to finish with return code 0, but it returned with code 1 instead! Output: // The Module object: Our interface to the outside world. We import// and export values on it. There are various ways Module can be used:// 1. Not defined. We create it here// 2. A function parameter, function(Module) { ..generated code.. }// 3. pre-run appended it, var Module = {}; ..generated UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)
Exception: Failed building WebGL Player. UnityEditor.WebGL.ProgramUtils.StartProgramChecked (System.Diagnostics.ProcessStartInfo p) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/ProgramUtils.cs:48) UnityEditor.WebGL.WebGlBuildPostprocessor.EmscriptenLink (UnityEditor.Modules.BuildPostProcessArgs args, System.Boolean wasmBuild, System.String sourceFiles, System.String sourceFilesHash) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:445) UnityEditor.WebGL.WebGlBuildPostprocessor.LinkBuild (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:495) UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:930) UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:27) UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:340) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)
Build completed with a result of 'Failed' in 46 seconds (46004 ms) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002af] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:194 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95 UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)
補足情報(FW/ツールのバージョンなど)
Unity2019.4.2を使用しています。
不十分な点がありましたら、教えていただけると助かります。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/09/01 04:38