Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug More WebGL problems. Only development build works, compressed files in wrong folder?

Discussion in 'Linux' started by Kaukamieli, Aug 26, 2015.

  1. Kaukamieli

    Kaukamieli

    Joined:
    Jul 14, 2015
    Posts:
    15
    When I create a development build, my project just works. When I create a non-development build, I get an empty Compressed folder, a Release folder with all the .jsgz files and my project doesn't load. I've read it _should_ put the compressed files in the Compressed folder, and normal files (which don't appear) to Release folder. Is there some steps I'm missing to make the nondev-build work?
     
  2. Kaukamieli

    Kaukamieli

    Joined:
    Jul 14, 2015
    Posts:
    15
    OK, I'm guessing I need to install apache to actually use those compressed files, amiright?
     
  3. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    Yes, you'll need a "real" web server to host the compressed files.
     
  4. Kaukamieli

    Kaukamieli

    Joined:
    Jul 14, 2015
    Posts:
    15
    Any plans to change that? Sounds a bit much for people just starting to learn this stuff and wants to upload simple stuff they made.
     
  5. Kaukamieli

    Kaukamieli

    Joined:
    Jul 14, 2015
    Posts:
    15
    I'm not sure if my webhotel I picked for this allows mod_rewrite in the .htaccess file, so I might be out of luck.

    You can't seriously be ditching web player and moving to WebGL if we can't upload these things practically anywhere.
     
  6. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    This is more a question for the main WebGL area - it works the same way on all platforms.
    Keep in mind though, it's not that we're ditching the webplayer - it's that browser vendors are ditching support for all native plugins.
     
    styno333 likes this.
  7. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Don't generalize too much, the files should work on majority of web hosting places either out of the box with the provided file or with some manual customization. If you are restricted to do any of these then it's probably related the subscription plan you have selected from your host. However like Tak said, these discussions belong to WebGL section.
     
  8. Chaoseiro

    Chaoseiro

    Joined:
    Aug 28, 2013
    Posts:
    40
    I've just checked here, and there really is a bug with WebGL non-development builds under Linux.
    On Windows, it generates:
    • Compressed folder - contains the compressed files
    • Release folder - contains the uncompressed files
    • TemplateData folder - generated if the chosen template was the default one
    • index.html
    • .htaccess
    Meanwhile, the same project built on Linux generates:
    • Compressed folder - empty
    • Release folder - contains the compressed files
    • TemplateData folder - generated if the chosen template was the default one
    • index.html
    • .htacess
    The .htaccess content is the same for both builds:
    Code (csharp):
    1. Options +FollowSymLinks
    2. RewriteEngine on
    3.  
    4. RewriteCond %{HTTP:Accept-encoding} gzip
    5. RewriteRule (.*)Release(.*)\.js $1Compressed$2\.jsgz [L]
    6. RewriteRule (.*)Release(.*)\.data $1Compressed$2\.datagz [L]
    7. RewriteRule (.*)Release(.*)\.mem $1Compressed$2\.memgz [L]
    8. RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz [L]
    9. AddEncoding gzip .jsgz
    10. AddEncoding gzip .datagz
    11. AddEncoding gzip .memgz
    12. AddEncoding gzip .unity3dgz
    As you can see, it won't work unless I modify it or move the compressed files to the correct folder (Compressed).
    The problem is that some game-hosting sites does not accept the .htaccess file nor the compressed files (e.g Newgrounds), so I can't just upload there a WebGL build that was made on Linux.
     
  9. CyRaid

    CyRaid

    Joined:
    Mar 31, 2015
    Posts:
    134
    My skill levels of Apache Conf Wizardry are quite low, but wouldn't you need the "AddEncoding gzip .jsgz" etc, inside the Release folder, for when it does a separate request for that folder? "RewriteRule" also allows Mime-Type as a flag, so:
    RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz [L,T=application/x-gzip]

    Also, try "x-gzip" instead of gzip, could work for some older servers that don't have mod_deflate?
     
  10. suoko

    suoko

    Joined:
    Apr 4, 2013
    Posts:
    3
    Compressed files are in the wrong folder for sure, but the release folder also misses some files.
    Check this project https://github.com/suoko/rocketgame which correctly works (http://suoko.github.io/rocketgame/).
    It has been produced with a windows build of unity.

    So if you move the compressed files to the correct folder and add the missing files in the release folder, the game works.
     
    Last edited: Oct 3, 2015
  11. Zingo_Fox

    Zingo_Fox

    Joined:
    Sep 24, 2015
    Posts:
    11
    I also got issues with webGL when building without the development option checked.

    For me Unity messes up the file extensions and the content of the .js files inside the release folder are garbled and broken.
     
  12. suoko

    suoko

    Joined:
    Apr 4, 2013
    Posts:
    3
    Can you try export this project ? https://github.com/noamgat/onebuttontorulethemall
    Different projects could result in different export problems.
    My result is:
    - Compressed folder empty
    - Release folder full of compressed files

    My machine is a 15.10 with java 8
     
  13. Zingo_Fox

    Zingo_Fox

    Joined:
    Sep 24, 2015
    Posts:
    11
    Tried to build, getting empty compressed folder, and the files in the release folder have wrong file extensions (.jsgz in stead of .js f.ex) and if i manually edit the file extensions the contents of the files are garbled.
     
  14. Chaoseiro

    Chaoseiro

    Joined:
    Aug 28, 2013
    Posts:
    40
    It's not that the content is garbage, it's just that it is gzip compressed :)
     
  15. Zingo_Fox

    Zingo_Fox

    Joined:
    Sep 24, 2015
    Posts:
    11
    No, it's not. No archive managers that I have can open them, and they have the same file names as the ones on the development build. Take UnityConfig.js for example, in the dev. build it a proper .js file, and the contents are readable. In the release build however, its named UnityConfig.jsgz and cannot be opened as an archive, and if you rename it back to .js and open it with a text editor, the contents are mangled.
     
  16. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    This will be fixed in the next build.
     
    amarok-blue likes this.
  17. steunity2

    steunity2

    Joined:
    Jun 16, 2015
    Posts:
    8
    Probably you did not, but maybe, maybe you have done this stupid thing like me.
    All "Debug" class things seemed to be ignored in normal builds.
    I had some codes like this:
    int x;
    Debug.Assert(int.TryParse("1",out x));​
    where Debug.Assert will not be executed in normal builds, so my x never gets initialized.