Search Unity

WebGL Retina Tool - 1.0

Discussion in 'Assets and Asset Store' started by tomhog, Nov 16, 2016.

  1. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Hi Everyone

    I'd just like to make people aware WebGL Retina Tools has now been accepted on the asset store

    Full version: http://u3d.as/CjZ

    Free lite version: http://u3d.as/Cpw
    supports development builds only

    WebGL Retina Tools adds Retina/HDPI resolution support to your webgl builds (Macbook retina displays etc).

    It's a one click solution to patching your built JS files and also provides example WebGLTemplates and detailed descriptions of how to get you're own templates working.

    If you're on a device with a hdpi/retina display try it for yourself.

    Non retina version
    http://www.hogbox.com/unity/plugins/webglretinatools/demos/nonretina/

    Retina version
    http://www.hogbox.com/unity/plugins/webglretinatools/demos/retina/

    Let me know what you think or if you have any questions.
     
  2. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
    Hi tomhog!
    Have you tried Unity 5.6 beta with WebAssembly enabled yet? Does your PlugIn work in that case?

    Thanks!
     
  3. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Hi atti

    Unfortunately I haven't tried it yet and my gut instinct tells me it won't work in it's current form. My guess is emscripten is going to just spit out the WebAssembly byte code which means our opportunity to inject the fix will no long be there. Perhaps I can look at either getting it to spit out js then we run it through the WebAssembly process ourselves or converting the WebAssembly back to javasscript, injecting the fix then converting back. Both sound like a fair amount of work so I'll try set some time aside to look at it as I use this myself on a client project.

    Tom
     
  4. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
    fyi:
    I had the same gut feeling, but it turns out the function "fillMouseEventData", that needs tweaking isn't wasm byte code. It's still readable javascript in a file called "<project name>.wasm.framework.unityweb". I'm about to add support for it to my own build tools.
     
  5. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Little update

    I've got WebglRetinaTools updated and working with Unity 5.6, both standard and WebAssembly builds, though I have a feeling the WebAssembly fix will break in a coming update as the js code isn't minified in release builds.

    The GZip compression was the tricky bit, you need to make sure you have a specific comment in the header of the file for the UnityLoader.js to accept it.

    Code (CSharp):
    1. "UnityWeb Compressed Content (gzip)"
    I've also been looking at Brotli support and have found a Brotli.Net library but need to look at making it cross platform as it's only Windows at the moment. So I'm gonna leave it out of this release.

    Just running some tests today, but seems to be working in Unity 5.3 up to 5.6. Yay

    How did you get on?
     
  6. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
    Well, I'm not using the Unity built-in compression, so it's easy for me.
     
  7. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
  8. fastgamedev

    fastgamedev

    Joined:
    Mar 27, 2014
    Posts:
    79
    Hi Tom,

    The tool no longer works with 2018.2, mouse coordinates are wrong. Can you please update it?

    Thanks!
    Arman.
     
  9. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Hi Arman

    I've just submitted a version 3.2 to the Asset store. It now supports Unity 2018.2. Should be available in a few days.

    Thanks
    Tom
     
    fastgamedev likes this.
  10. fastgamedev

    fastgamedev

    Joined:
    Mar 27, 2014
    Posts:
    79
    @tomhog,

    Thank you, works like a charm.
     
  11. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    when I use a template, the game does not work. I see just black screen
     
  12. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Hi freedom667

    What template are you using? Other user have reported trying to use responsive templates in the past that alter the WebGL canvas's dimensions. This is how the fix works and will cause issues. Do you have a link to the template you're using?

    Thanks
    Tom
     
  13. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    Actually, it is happening the all responsive template. for example Universal WebGL Template asset
     
  14. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    I had someone contact me about this in past, they fixed it but they found a different template and didn't inform me which. If you're using a custom template you'll need to ensure the canvas dimensions retain the scale being applied to them by the fix.

    I'll try add a responsive template myself. Essentially you will just need to ensure the width and height of the canvas take into account the fact that the canvas needs to be scaled by the device pixel ratio.

    https://www.html5rocks.com/en/tutorials/canvas/hidpi/
     
    Last edited: Feb 6, 2019
  15. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Update as I've had a strangely large number of support requests the last few days.

    I have plans to implement the following in the next couple of weeks once I have a client project completed.

    1. Test with latest Unity version
    2. Add support for 'Filenames as Hashes' option in the WebGL build settings
    3. Add an example of a responsive WebGL Template that will also support the retina fix.
    4 Look into handling of DPI scaling in relation to device orientation on mobile devices.

    Thanks
    Tom
     
  16. tcvpromo

    tcvpromo

    Joined:
    Jun 7, 2017
    Posts:
    25
    Any news? We need support for 'Filenames as Hashes' option :)
    And this plugin works with wasm?
     
    Last edited: Mar 21, 2019
  17. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    I've finally made a start on this. I'll make file 'File Names as Hashes' a priority and maybe do an earlier release of the simpler features.
     
  18. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Version 3.3 is now available it adds support for the following

    - 'Name Files as Hashes' publishing option is now supported.
    The tool will recalculate the Hashes and inject the new file names into your template
    - The settings are now stored in a json file so they can be shared between users.
    - Few improvements to the way the fix is applied.

    With this version I'm depreciating support for Unity 5.6 and lower to enable a more streamlined fix in future builds.

    Apologies for the delay. My first child was born so been rather busy haha
     
  19. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    I've also dropped the price for a while!
     
  20. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    there is a bug I think. I using the WebGL template of simmer.io and me exporting it but when I apply your tool to the built app, the app becomes huge just like zoom. Why?
     
  21. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
  22. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
  23. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    your asset does not work properly with templates. why I don't know
     
  24. learningbank

    learningbank

    Joined:
    Jun 2, 2017
    Posts:
    7
    Anyone figured out how to make this asset work with templates? I'm trying to use the responsive template from simmer, but run into same issues as others in this thread.