How to find platform screen size and use it as default

So, I was wondering if there was a way to find out the screen resolution and size of a specific platform, and also if there’s a way to implement that one as the default to my game. To be more senario specific, I plan to upload the game I’m working on for the Unity 2D cources to Share My Game, but whenever I make a build and run it, UI elements always appear bigger and slightely differently spaced than in the Game Engine, I’m guessing because Web GL uses a different screen size or something. So rather I was wondering how I would find out what screen size or resolution or whatever the browser is using so I can put that as the default for the canvas, so I can see what it’ll look like in the final build instantly.

I’m not sure if you can get the device native resolution, but worry not, there’s something you can do to fix your UI issues.

First of all, since you are uploading to Share My Game you’ll need to set your resolution manually: Go to Project Settings - Player - Resolution, Set the canvas width and height to what you desire.

Then set Unity’s resolution to the same width and height.

This way you’ll get the exact same view as the player while editing.
Hope this helps.

That did it! thanks! The Project settings were at the default 900 x 600, while I had my game window at 4:3, so that absolutely made things look different.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms