• 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 /
  • Help Room /
avatar image
-1
Question by AaronC · Nov 20, 2015 at 10:27 PM · codepagequalitysettings

Depreceated code advice

The pause script on the Wiki gives this error UnityEngine.QualitySettings.currentLevel' is obsolete: `Use GetQualityLevel and SetQualityLevel'

The code is

 void Qualities() {
         switch (QualitySettings.currentLevel) 
         {
         case QualityLevel.Fastest:
             GUILayout.Label("Fastest");
             break;
         case QualityLevel.Fast:
             GUILayout.Label("Fast");
             break;
         case QualityLevel.Simple:
             GUILayout.Label("Simple");
             break;
         case QualityLevel.Good:
             GUILayout.Label("Good");
             break;
         case QualityLevel.Beautiful:
             GUILayout.Label("Beautiful");
             break;
         case QualityLevel.Fantastic:
             GUILayout.Label("Fantastic");
             break;
         }
     }

I don't understand how to code case switch stuff so can't seem to find a way to fix it. Any advice?

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 AaronC · Nov 20, 2015 at 10:27 PM -1
Share

the errors on the second line

avatar image Le-Pampelmuse · Nov 20, 2015 at 10:39 PM 0
Share

Please read the Frequently Asked Questions and the User Guide.

The error tells you exactly what is wrong and what you need to do. If you google this error, you will find that your question has already been answered. Please search for your question before you ask a new one.

Have a nice day.

1 Reply

· Add your reply
  • Sort: 
avatar image
-2
Best Answer

Answer by AaronC · Nov 20, 2015 at 10:53 PM

  switch (QualitySettings.GetQualityLevel()) 
         {
              case 0:
                 GUILayout.Label("Fastest");
                 break;
              case 1:
                 GUILayout.Label("Fast");
                 break;
              case 2:
                 GUILayout.Label("Simple");
                 break;
              case 3:
                 GUILayout.Label("Good");
                 break;
              case 4:
                 GUILayout.Label("Beautiful");
                 break;
              default:
                 GUILayout.Label("Fantastic");
                 break;
          }

Is the replacement code. ALthough I was trying this already I failed to see that the two brackets were required. No need to be a dick about it "Le Pampelmuse"

Fixing Wiki now...

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 Dave-Carlile · Nov 21, 2015 at 12:13 AM 2
Share

You can go ahead and accept your answer if it answers your original question. In the future please use the Help Room area for common syntax error sorts of questions. You can also generally google things like "C# switch syntax" and find the actual C# documentation and such.

avatar image AaronC · Nov 21, 2015 at 12:28 AM 0
Share

Thanks for the helpful advice Dave, will do.

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

34 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 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 avatar image avatar image

Related Questions

Unity coding problem 1 Answer

Combine If Statement Conditions 1 Answer

Instantiate question 0 Answers

Trying to get the Exit Game to work. 1 Answer

My gameobject variable appearently doesn't exist. (I am usint Unity 5.6) 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