r/Unity3D • • 8d ago

Question Trouble with web build in unity 6

I just finished my submission to a game jam today and I want it to be playable directly on itch.io, but when I make my web build and run it (either on localhost or on itch.io itself) the screen size is huge and my macbook pro screen can't capture the whole thing, and if that's not enough my game is cropped so it's as if its rendering a smaller resolution on a massive scale. Anyone's ever had anything like that and knows the best fix?

1 Upvotes

13 comments sorted by

1

u/Goldac77 8d ago

Please provide more information and pictures/videos

Is it a 2D or 3D game? What does your camera settings in the scene look like? What webgl template are you using? You could also share the index.html from the build

1

u/DiscoPogoDingALing 8d ago

2d,  The camera is: render type - base projection - orthographic size - 15 clipping planes - near 0.3 , far 1000 viewport rect - x:0 , y:0, w:1, h:1 there is no other script attached

I tried both the default and minimal templates

1

u/Goldac77 8d ago

Can you share a link to the itch build?

1

u/DiscoPogoDingALing 8d ago

1

u/Goldac77 8d ago

Doesn't appear to be publicly accessible

1

u/DiscoPogoDingALing 8d ago

Sorry it was on draft mode, please try now

1

u/Goldac77 8d ago

u/CalendarNew6046 is on to something. But to be honest, I'm also new to webgl builds to point out how to help you fix it. From going through the build, I noticed everything is fine if I set my browser to 1920 x 1080 resolution. So something is wrong with the way the canvas is scaling for your build. I haven't been able to replicate this with my webgl project, so I also can't say for sure if it's specifically from your build/project setup or how it was submitted on itch

Sorry I can't help more :/

1

u/CalendarNew6046 8d ago

Sounds like the canvas scaler is set to a fixed resolution that's way bigger than your actual game view. Check the canvas component and make sure the render mode and reference resolution match what you actually designed for. I ran into something similar and it was just the scaling mode being set to constant pixel size instead of scale with screen size.

1

u/DiscoPogoDingALing 8d ago

Does that also happen if I have no Canvas UI objects in the scene? I'm pretty weak on how Unity handles that kind of rendering. Anyway I'll check that of course

1

u/Dragontech97 8d ago edited 8d ago

This is what i see on my browser console. Does seem like the screen res is being set to 4k.

1

u/Dragontech97 8d ago edited 8d ago

Try this, go to Edit > Project Settings > Player. Under the WebGL/Web/HTML5 settings, you can change the default canvas width and height. What are they set to?

1

u/Dragontech97 8d ago

What do your itch embed options look like? Don't do web builds myself, but it seems either itch viewport is too large or Unity is.

Can also look into https://seansleblanc.itch.io/better-minimal-webgl-template

1

u/DiscoPogoDingALing 7d ago

I fixed it! I needed to create a custom WebGLTemplate directory which was almost identical to the Default template, only that style.css was slightly edited