• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by Jean-Fabre · Oct 13, 2010 at 11:08 AM · webplayerfullscreenaspect-ratiowrong

webplayer fullscreen aspect ratio wrong

Hi,

Having a difficult time fixing the aspect ratio when user is going fullscreen using my webplayer built.

Any hints why aspect ratio is not respected and/or what can be done to make sure aspect ratio is right and pixels are not distorted when going fullscreen on a webplayer?

thanks,

Jean

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ArnoC · Apr 22, 2015 at 09:59 AM 0
Share

Yep, try my answer below!

6 Replies

· Add your reply
  • Sort: 
avatar image
8
Best Answer

Answer by Jesse Anders · Oct 15, 2010 at 03:00 PM

I don't have an answer per se, but since you haven't gotten any replies yet I'll go ahead and respond.

My understanding of the web player's behavior (which may be incorrect) is:

  • Fullscreen mode defaults to the default resolution for the standalone as specified in the 'Player' project settings.
  • If this resolution is not supported, the closest resolution is selected.
  • The selected resolution is then adjusted so that it's no greater than the desktop resolution.

I haven't done any testing on non-4:3 monitors yet, so I'm just speculating here, but it seems to me that in some cases this could result in selecting a resolution with an aspect ratio that's different than the screen's native aspect ratio. Is that the problem you're running into?

A suggestion I've seen made on the forums is to set the default width and height for the standalone to values that are higher than any modern hardware is likely to support. Assuming the process the web player uses to select a fullscreen resolution is as I described above, this would ensure that the desktop resolution was selected (which means if the desktop resolution has the right aspect ratio, your game will too).

It seems to me this could be the wrong choice in some situations though. Say the user has his or her desktop set at 1600x1200; some games might perform poorly at that resolution, and for them a lower resolution would be more appropriate.

So I don't know the answer, but having started working on the web player version of my current project, I've been wondering about this as well. I certainly don't want users switching to fullscreen and getting a stretched or distorted image (I'd rather not have a fullscreen option at all, although that wouldn't be ideal either).

Again though, I've only just started to look into this (I'm sure there are others here who could offer much better answers).

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jean-Fabre · Oct 19, 2010 at 03:22 PM 0
Share

Thanks Jesse for your insight, much appreciated, Will get back on this question if I have any more infos to add or a proper answer myself...

avatar image Jean-Fabre · Nov 22, 2010 at 09:48 AM 0
Share

your trick worked, thanks.

avatar image
0

Answer by ArnoC · Apr 22, 2015 at 09:57 AM

Use Direct3D 9 instead of 11 => boom, it works! (at least for me) And I have no glitches with D3D9, whereas with D3D11 my windows are a bit messed up once I leave fullscreen mode in my web player game.

It's true though that the desktop resolution settings corresponds (roughly) to the web player fullscreen resolution setting, but only with D3D9.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by FWCorey · Oct 03, 2012 at 01:59 AM

If performance at a particular resolution could be an issue, provide a game options menu with select-able resolutions from a List<> then save them to PlayerPrefs you can read them back when you switch to fullscreen. If you are using PlayerPrefs I recommend setting your preference strings to static constants as well so you don't have issues where you typoed a name.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
4

Answer by Gillissie · Apr 20, 2011 at 05:46 AM

Easy, just set the full screen resolution to the desktop resolution.

function toggleFullScreen()
{
if (Screen.fullScreen) { // Set your windowed resolution to whatever you want here. Screen.SetResolution(760,600,false); } else { // Switch to the desktop resolution in fullscreen mode. Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true); }
}
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image doomlazy · Jul 06, 2014 at 12:34 PM 0
Share

This doesn't work. I made a empty game object called resolution and dragged this script onto it. I then put the prefab in all of my scenes but when I right-click the game and "go fullscreen" it hasn't changed anything. Any help guys?

avatar image
0

Answer by Foss · Feb 21, 2011 at 10:57 PM

I have the same problem

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

webplayer resolution problems/issues/oddities and frame rate weirdness 6 Answers

Going full screen (no, really full screen) with Web Player 3 Answers

How can a 4:3 aspect ratio be kept on any screen when switching to Full screen mode using Web player? 2 Answers

Web player : fullscreen : ready for primetime? 0 Answers

Full Screen Web Player? 7 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges