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 alemimi · Dec 07, 2013 at 10:35 AM · levelqualitynotworking

"GetQualityLevel" is not a member of "QualitySettings"

Hello guys, basically my problem is that i'm creating an in-game Menu, with "options", "start game" and all that sort of things, and in the "options" tab I have a general quality setting. But my script isn't working, I read the Unity Scipt Reference page regarding all the Quality scripts (SetQualityLevel, GetQualityLevel, Increase and Decrease);

Here is my code (really simple):

 var qualityLevel = QualitySettings.GetQualityLevel();
 
 function Update () {
     GetComponent.<TextMesh>().text = "Quality: " + qualityLevel;
 }

And then I attach the script to a Text object, but i get an error from the compiler, saying that "GetQualityLevel" is not a member of "QualitySettings". WHAT IN THE WORLD does it mean? It's clearly written in the Reference page that to return the quality level you need to use that variable (Here is the page), am I doing something wrong? How can I make the script say what graphics setting I have?

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 meat5000 ♦ · Dec 07, 2013 at 10:38 AM 0
Share
 var qualityLevel; //of whatever type is it.
 
 function Awake()
 {
     qualityLevel = QualitySettings.GetQualityLevel();
 }

I suspect you can only perform this action inside a function.

avatar image alemimi · Dec 07, 2013 at 11:10 AM 0
Share

The problem is still the same: BCE0019: 'GetQualityLevel' is not a member of 'QualitySettings'. I really don't get it.

avatar image Fornoreason1000 · Dec 07, 2013 at 12:12 PM 0
Share
 var qualityLevel : int =  QualitySettings.GetQualityLevel();

according to the almighty docs , this should compile. one question, is the error co$$anonymous$$g from $$anonymous$$ono Develop/VS 2012 or Unity itself?. The error means what it means "GetQualityLevel" doesn't exists as far as the compiler is concerned. now we now for a fact that it DOES exists.

the question is, why is the compiler confused. Double check in your code that is spelled correctly. If the error appears in your script editor and not unity , restart the script editor. is that all of the code in the file? a missing "{" or ";" might be what throwing you and the compiler off.

also your code should be

 GetComponent<Text$$anonymous$$esh>().text = "Quality: " + QualitySettings.names[qualityLevel];
avatar image alemimi · Dec 07, 2013 at 12:39 PM 0
Share

The error is co$$anonymous$$g from Unity itself from the error bar at the bottom of the Unity Editor. If i copy/paste your code, i get 3 errors about some unexpected tokens (the ")" in "().", the "." in "()." and that the compiler was expecting a ";" at the end of "()."), and if i delete the function and leave the "var qualityLevel : int = etcetc" alone i get the same error about "GetQualityLevel" not being a member of "QualitySettings".

avatar image Fornoreason1000 · Dec 07, 2013 at 01:05 PM 0
Share

^now that is weird, it works perfectly on my end...at any rate your code that you posted isn't causing the problems, something else is. is there more of your code in that script? if so post it!

None else is getting the errors you are. so that tells me somewhere else in your code is at fault.

Show more comments

2 Replies

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

Answer by meat5000 · Dec 07, 2013 at 11:53 AM

If I use your script I get

GetQualityLevel can only be called from the main thread.

If I move the call to Awake it works nicely.

Do you have #pragma strict in your code?

The following works for me with no errors.

 #pragma strict
 
 var qualityLevel;
 
 function Awake ()
 {
     qualityLevel = QualitySettings.GetQualityLevel();
     Debug.Log(qualityLevel);
 }
Comment
Add comment · Show 7 · 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 alemimi · Dec 07, 2013 at 12:28 PM 0
Share

Yes I have #pragma strict, I only didn't write it in the pastebin because I didn't find it useful for you. That's strange, I get the same error with your code, and I updated Unity yesterday. Do you have the latest Unity?

avatar image meat5000 ♦ · Dec 07, 2013 at 12:41 PM 0
Share

Yes, 4.3.1

avatar image meat5000 ♦ · Dec 07, 2013 at 12:44 PM 0
Share

Perhaps try it in a blank project?

avatar image alemimi · Dec 07, 2013 at 01:16 PM 0
Share

I am going to try that in a blank project...

avatar image alemimi · Dec 07, 2013 at 01:31 PM 0
Share

Ok that's weird, in another project your code works, now I have got to find out what is the problem with my main project... there could be something that interferes with the quality settings? There's only another script on the TextObject used for Quality, this one:

 var isVolumeButton = false;
 var isOptionButton = false;
 var isBackButton = false;
 var is$$anonymous$$Button = false;
 var is$$anonymous$$in2Button = false;
 var is$$anonymous$$in1Button = false;
 var isQuitButton = false;
 public static var camera$$anonymous$$ove = 0;
 
 function On$$anonymous$$ouseEnter()
 {
     //change the color of the text to green
     renderer.material.color = Color.green;
 }
 
 function On$$anonymous$$ouseExit()
 {
     //change the color of the text back to white
     renderer.material.color = Color.white;
 }
 
 function On$$anonymous$$ouseUp()
 {
     //are we dealing with the Quit button?
     if(isQuitButton)
     {
         //quit the game
         Application.Quit();
     }
     else if(is$$anonymous$$in1Button)
     {
         //load level 1
         Application.LoadLevel(1);
     }
     else if(is$$anonymous$$in2Button)
     {
         //load level 2
         Application.LoadLevel(2);
     }
     else if(is$$anonymous$$Button)
     {
         //move the camera
         camera$$anonymous$$ove = 1;
     }
     else if(isBackButton){
         //moves the camera back
         camera$$anonymous$$ove = 0;
     }
     else if(isOptionButton){
         //moves the camera to options
         camera$$anonymous$$ove = 2;
     }
     else if(isVolumeButton){
         //changes the volume
         Send$$anonymous$$essage("point02");
     }
 }

This is the code for the buttons of my $$anonymous$$enu, I still didn't write the code about the Quality setting because of the "GetQualityLevel" problem

Show more comments
avatar image
0

Answer by Raiden-Freeman · Dec 07, 2013 at 10:49 AM

I'm pretty certain, that you need to declare var qualityLever as an int. Try out:

 var a : int;
     
 function Start () {
     a = QualitySettings.GetQualityLevel ();
     Debug.Log(a);
 }

Also it's an integer, not a string. It's best that you use this when assigning to text:

 GetComponent<TextMesh>().text = "Quality: " + qualityLevel.ToString;

Also, remember that you need to call QualitySettings, only in functions like Awake and Start (I think).

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 alemimi · Dec 07, 2013 at 11:13 AM 0
Share

Still the same...

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

19 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

Related Questions

troble with the Axis in unity 1 Answer

OnMouseUp not working in build? 0 Answers

MuzzleFlash not working 0 Answers

splatPrototypes not changing in exported game 0 Answers

WaitForSeconds not working in while 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