Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
2
Question by AVividLight · Jul 05, 2010 at 04:13 PM · screenresizeautomatic

Automatic Screen Resize

Hey All,

I was wondering how I would automatically re size the window so that it fits in the screen... I have a large computer, but my friends (and a lot of other people) have laptops and the buttons and text run off the screen! Is there a way to re size the screen, depending on the screens maximum size, so that they can see everything I see... Any Help Is Appreciated!

-Gibson of GBSoftware-

Comment
Add comment · Show 2
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 spinaljack · Jul 05, 2010 at 05:42 PM 0
Share

why don't you just use full screen by default?

avatar image AVividLight · Jul 06, 2010 at 03:48 PM 0
Share

Even in full screen its to big for them...

4 Replies

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

Answer by cncguy · Jul 06, 2010 at 10:06 PM

Hi when I maximise my application I use:

Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);

this maximises the unity application and sets the resolution to the current desktop resolution.

Screen.currentResolution returns the current desktop resolution of the machine.

true/false sets the fullScreen state.

you can then go back to windowed with:

Screen.SetResolution (1024, 768, false); //enter you desired resolution

To switch between fullScreen and not only you can use:

Screen.fullScreen = true/false;

[EDIT 1] To make sure that your GUI resizes to the new resolution:

function OnGUI() { var oldMatrix : Matrix4x4; var tMatrix : Matrix4x4; var width : int = 1024; //Reference resolution var height : int = 768; //Reference resolution

oldMatrix = GUI.matrix; //Store current matrix tMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3(1.0*Screen.width/width, 1.0*Screen.height/height, 1.0)); //Construct matrix to scale to actual view size GUI.matrix = tMatrix; //Set the GUI matrix to the scaling matrix

drawYourGUIElementsToSuitReferenceResolution(); //as the function says;)

GUI.matrix = oldMatrix //Set the original matrix back }

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 AVividLight · Jul 06, 2010 at 10:24 PM 0
Share

I can't get it work... How should I use it?

avatar image cncguy · Jul 07, 2010 at 01:06 AM 1
Share

Oh sorry I missed the bit about your GUI elements going off the screen. I'll make an edit above. Hang on.

avatar image
2

Answer by Tetrad · Jul 05, 2010 at 07:16 PM

Are you talking about the window itself being larger than the screens, or are you talking about the resolution being reduced but all your 2D GUI stuff being off screen?

If it's the latter, you'll have to use some special code to make your UnityGUI stuff resolution independent.

See here: http://forum.unity3d.com/viewtopic.php?p=91926

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
1

Answer by alex 1 · Jul 05, 2010 at 06:50 PM

You will need to disable the resolution dialog.

You can do this by going into 'Edit' on Unity. Then select 'Project settings' then 'player' then click Display Resolution Dialog 'Disabled'

Alex

Comment
Add comment · Show 3 · 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 AVividLight · Jul 06, 2010 at 03:52 PM 0
Share

What will disabling the resolution dialog do?

avatar image alex 1 · Jul 06, 2010 at 04:00 PM 0
Share

Disabling the resolution dialog will remove the startup dialog that comes with Unity when somebody plays your game. I feel it gives it a more professional feel. You can still change the settings within the game so your not locking yourself out of changing the settings.

avatar image AVividLight · Jul 06, 2010 at 07:48 PM 0
Share

That would work if ANY of the setting worked on a laptop but I don't think any of the do! In the editor game view I have it set to 4:3 and for my testers 4:3 is way to big!

avatar image
0

Answer by Donato · Mar 12, 2011 at 02:44 PM

I have try to insert in the Awake of my script this instruction:

Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);

for to play with current desktop resolution my game.

But nothing!!!

It start to resolution 1024x768 that is to default from :

File/BuildSetting/PlayerSetting/"Resolution"

WHY it think that my desktop resolution is 1024x768? There is a way for to start before this script and next the setting of Unity?

Ps. I have disable DISPLAY RESOLUTION DIALOG.

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 tonydemot · Aug 27, 2012 at 09:58 PM 0
Share

if you go to build settings and then player setting it should show you the default screen hight and width

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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

GUI Resize Mobile 3 Answers

how to get Gui in OnGUI function to resize with the window? 1 Answer

Testing orthographic camera at various resolutions -- detect window resize? 1 Answer

Script for resize aspect ratio for every device (andorid 2D) ?? 0 Answers

iphone screen too big? 0 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