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
0
Question by Ochreous · Oct 02, 2013 at 10:57 PM · c#sliderquality

Overall Quality Horizontal Slider

Hi everyone, I'm trying to make a horizontal slider that will control overall quality. I'm trying to do something similar to what the Bootcamp demo did. I can't get it to work because QualitySettings.currentLevel isn't an integer. Is there a way to make custom variables like QualitySettings.currentLevel work with a horizontal slider?

 public int overallQualityInt;
 
     overallQualityInt = Mathf.RoundToInt(GUILayout.HorizontalSlider(overallQualityInt, 0, 4,GUILayout.Width(150), GUILayout.Height(35)));
     QualitySettings.currentLevel = Mathf.RoundToInt(Mathf.Pow(2, overallQualityInt));
Comment
Add comment · Show 6
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 AndyMartin458 · Oct 02, 2013 at 11:04 PM 0
Share

I think that the QualitySettings.currentLevel value is deprecated in Unity 4, so I cannot check if it is readonly, but this method should work great for you. Originally, I was thinking you could use a switch to set this, but using the SetQualityFunction will probably yield the best results.

 int overallQualityInt = GUILayout.HorizontalSlider(overallQualityInt, 0, 4,GUILayout.Width(150), GUILayout.Height(35);
     
 QualitySettings.SetQualityLevel(overallQualityInt);
 
avatar image Ochreous · Oct 02, 2013 at 11:27 PM 0
Share

I really don't want to do that, unless it's my last resort and I have no other choice.

avatar image AndyMartin458 · Oct 02, 2013 at 11:32 PM 0
Share

So what is the range of the variable the the currentLevel is expecting? If it wants something 0-1 and the slider goes 0-10, then you could scale the slider value appropriately.

avatar image Ochreous · Oct 02, 2013 at 11:38 PM 0
Share

I don't understand. currentLevel doesn't accept integers or equal signs. You just mentioned what function you need to use with QualitySettings in order to change it and that is QualitySettings.SetQualityLevel(someLevel); .

avatar image Ochreous · Oct 03, 2013 at 12:00 AM 1
Share

I ment I didn't want to use a Switch Statement. Yes it did work with the SetQualityLevel function.

Show more comments

1 Reply

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

Answer by Ochreous · Oct 03, 2013 at 12:47 AM

I found a way to make it work. You just change the SetQualityLevel's integer to overallQualityInt.

 int overallQualityInt = GUILayout.HorizontalSlider(overallQualityInt, 0, 4,GUILayout.Width(150), GUILayout.Height(35);
  
 QualitySettings.SetQualityLevel(overallQualityInt);
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 AndyMartin458 · Oct 03, 2013 at 12:50 AM 0
Share

awww man, you could have selected my answer ins$$anonymous$$d of typing in the exact same thing and clai$$anonymous$$g it for yourself. That's not really fair. I edited my typo as you can see in the version history of my answer.

avatar image ArkaneX · Oct 04, 2013 at 03:38 PM 0
Share

I think it's not possible to see version history of an answer if you're not author, or possibly moderator. But if there was really only a typo, then I agree that original answer should have been accepted...

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

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to check if an object is colliding with another from another script ? 1 Answer

How to check if string array contains duplicates C# 1 Answer

Finding Distance between Angles and Points 2 Answers

C# Deserializing XML and Assigning Values 1 Answer

How to create an Idle counter ? 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