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 raul corrales · Dec 08, 2010 at 11:01 AM · resolutionscreenchange

how I can change the screen resolution in real time?

how I can change the screen resolution in real time?

i want put this:

Screen.SetResolution (640.480, false);

But where I put it?

Thanks in advance

Comment
Add comment
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 Reply

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

Answer by Proclyon · Dec 08, 2010 at 11:48 AM

There are many options.

Here's an idea:

Make a script JS/C# it doesn't matter right now which.

Attach the script to an object that you can send input with the input manager.

Make a method that responds to input.

Set the value of the screen when the input matches that of the requirement for the method 'somekey'

potentially you may want to have two public floats so you can change the values to (x,y) instead of your hardcoded (640,480). Having them public means you can change it quite easily in the inspector ( and it matters for inheritance , proper design and code safety , but I don't think you really need to know that right now for this question so if you don't know what it is just forget about it for the moment and assume public just let's you change it in the editor)

So then the fields of the class and body of the change method would become:

//two variables with poorly chosen names for the resolution var x : float; var y : float;

function Update() { //Updates the input every frame UpdateInput(); }

function UpdateInput() { //Your input reading code here }

function SetResolution(x,y) //The parameters for the set resolution method { //Sets the resolution of the screen to x y Screen.SetResolution (x,y, false); }

Sorry if the code isn't that great, I had to look up most of the syntax since I don't understand JS that much, just C#. I hope this shows the general outline of such a script. Getting inputhandling done is something you should be able to do (yes even if you are not a programmer!) , but that is just my opinion

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 raul corrales · Dec 08, 2010 at 11:57 AM 0
Share

very thanks you

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

No one has followed this question yet.

Related Questions

Which Is The Actual Game?(Max or no Max Screen) 1 Answer

How to call Screen.SetResolution() only once before the first scene starts loading ? 1 Answer

Position GameObject to Bottom Left Corner 2 Answers

How to make game recognise Screen resolution on startup 1 Answer

Where is Screen.Resolutions stored? 2 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