unity3d - 无法在 Unity 中构建 WebGL
问题描述
我正在尝试在 WebGL 中构建我的统一项目,但它一直给我一个错误。构建结果说它成功但在文件夹中,什么都没有。
这是我得到的错误。
FileNotFoundException:找不到文件“C:\Users\TIGER\Desktop\UnityTest\Prototype3\Temp\StagingArea\Data\Native\build.bc”System.IO.FileStream..ctor(System.String 路径,System.IO. FileMode 模式,System.IO.FileAccess 访问,System.IO.FileShare 共享,System.Int32 bufferSize,System.Boolean 匿名,System.IO.FileOptions 选项)(在:0) System.IO.FileStream..ctor(System. String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) (at :0) (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string, System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) System.IO.File.OpenRead (System.String path) (at :0) System.IO.File.ReadAllBytes (System.String path) (在:0) UnityEditor.WebGL.WebGlBuildPostprocessor.LinkBuild (UnityEditor.Modules.BuildPostProcessArgs 参数)(在 /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:464)UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess(UnityEditor.Modules.BuildPostProcessArgs 参数)(在/Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:954)UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess(UnityEditor.Modules.BuildPostProcessArgs args,UnityEditor.BuildProperties& outProperties) (在 C:/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 产品名称,系统。Int32 宽度、System.Int32 高度、UnityEditor.BuildOptions 选项、UnityEditor.RuntimeClassRegistry usedClassRegistry、UnityEditor.Build.Reporting.BuildReport 报告)(在 C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:286) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (在 C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
解决方案
使用 unity webgl 时无法访问本地文件系统。如果有任何处理 System.IO 功能的 csharp 文件,请将它们置于此检查并构建。
#If !UNITY_WEBGL
#endif
推荐阅读
- visual-studio - 如何将 WIX 扩展添加到 Nuget 包以供 WIX 安装程序项目使用
- angular - 错误处理异步管道 - Angular
- android - 用于延迟数据库下载的 RecyclerView Adapter 中的 Android ViewModel
- c++ - 模板模板参数:以下示例中应用了什么规则
- html - CSS Grid 在 flexbox 内时不会增长
- python - 更改装饰器内的实例属性
- sql - 如何忽略完全重复的行,但在列中有重复是可以的?
- c# - SQL Server 列类型 time(7) 不会显示在 Crystal Reports 中
- reactjs - 在 React App 中获取损坏的图像
- java - 通过 javax.websocket API 使用 Jetty Websocket Client API:如何设置 MaximumMessageSize?