greggman / better-unity-webgl-template

A better default template for Unity WebGL
https://greggman.github.io/better-unity-webgl-template/
Creative Commons Zero v1.0 Universal
760 stars 137 forks source link

Work great on PC (fullHD) but it look pixelated in the mobile browser (fullHD+) #21

Open nminhhoangit opened 3 years ago

nminhhoangit commented 3 years ago

Your template work great on browser in pc. But when I open from mobile browser with fulldHD+ resolution it look very pixelated. This not happened on unity editor or build to android apk but only in webgl on mobile browser only.

Please help me to solve this. Thanks!

greggman commented 3 years ago

You can try deleting this line in Assets/WebGLTemplates/Better2020/index.html

https://github.com/greggman/better-unity-webgl-template/blob/ba9152705c2f4a58ab5ab58f86f8d3f61fd079ed/Assets/WebGLTemplates/Better2020/index.html#L70

Be aware that higher-res = lower performance

You might also consider something like

 config.devicePixelRatio = Math.min(config.devicePixelRatio, 2);  // or 3 etc. 

Some phones are as high as 4 I believe which is up to 16x slower than 1

Enigo commented 2 years ago

hey @greggman! Just curious - do you intend to persist that change? Because I just faced the same issue and your solution helped.

greggman commented 2 years ago

@Enigo, At the moment I don't intend to persist that change. You should just edit your local copy to do what's right for your app. There's no "one size fits all" solution here.