Home / Article / Unity WebGL and Retina Display Devices: Editor Script

Unity WebGL and Retina Display Devices: Editor Script


So far, this little hack for Retina Display Devices is working, at least for me. However, It is quite annoying to apply it each time the project is built. So, I decided to develop a better solution to apply it without any effort.

Probably it is possible to use the same modified file but I decided to have some fun creating this solution.

Basically, the script performs automatically all the above steps after each WebGL build:



In this script I’m always multiplying by 2 instead of the device pixel ratio.

To use it, create a new C# script called WebGLBuildHelper.cs, paste the above code and place it inside an Editor folder. This way it will run automatically by default after each WebGL build. If you need to disable it, you can open the Editor Window using the top menu  Add Component/Builds/Helper.

unity webgl retina display devices
Build Helper Editor Window

If building for WebGL I also suggest you use a WebGL Custom Template. It will save you some precious time.

Happy Coding

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • Pinterest
  • Reddit

Talk to me :)
%d bloggers like this: