0

我有一个小型 Unity 游戏,我正在尝试使用 WebGL 将其导出,以便可以将其包含在我们的 Rails 应用程序中……也就是说,我不知道将文件放在哪里或如何处理它们所以他们会被正确地捡起。通过在黑暗中刺伤,我已经能够让数据/代码/memUrl 值指向文件(或者至少停止对我出错),但我必须在文件扩展名中添加“gz”才能获得它们捡起来,所以我不知道这是否破坏了任何东西。

我将 UnityLoader.js 放在 public/javascripts 中,公开发布文件夹。我收到一些像这样的 JS 错误:

Invoking error handler due to
Uncaught SyntaxError: Invalid or unexpected token
blob:http://localhost:3000/d38265a6-af46-425c-acd0-6eba9d0d5cd9:1 

这是我的 html.erb

    <script type='text/javascript'>
    var Module = {
      TOTAL_MEMORY: 268435456,
      errorhandler: null,           // arguments: err, url, line. This function must return 'true' if the error is handled, otherwise 'false'
      compatibilitycheck: null,
      dataUrl: "Release/TestExternCall.datagz",
      codeUrl: "TestExternCall.jsgz",
      memUrl: "Release/TestExternCall.memgz",
    };
    </script>

<%= javascript_include_tag 'UnityLoader'%>

有没有人在教程中写下如何在 Rails 应用程序中包含 WebGL 输出?任何帮助将不胜感激。

4

0 回答 0