Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 sacajawhoohoo · Jul 26, 2015 at 09:28 AM · not workingissuequalityqualitysettings

Quality Settings To Turn On Object

Hello, I am trying to turn on an object based off of the quality setting, I have this script:

 var object1 : GameObject;
 
 function Awake ()
 {
     QualitySettings.GetQualityLevel();
 }
 
 function Update () 
 {
     if (QualityLevel.Fastest)
     {
         object1.gameObject.SetActive(true);
     }
 }

And I get no errors with it, even during runtime, however it is not working at all. I dont understand where I am going wrong.

Comment
Add comment · Show 4
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 maccabbe · Jul 26, 2015 at 10:08 AM 0
Share

If you want to learn about scripting, please follow a tutorial. For instance Unity provides a scripting tutorial at

https://unity3d.com/learn/tutorials/topics/scripting

avatar image sacajawhoohoo · Jul 26, 2015 at 11:24 AM 0
Share

I already know basic scripting, but Im having an issue with a script which is why I came here with my problem. Telling me to learn scripting kindof just defeats the purpose of all of Unity Answers.

avatar image Hexer · Jul 26, 2015 at 01:13 PM 0
Share
         if( QualitySettings.LevelName == QualityLevel.Fastest){
 
 }

Try this, I don't know if it will work but it is worth a try.

EDIT : I usually run a debug.log() or print() to see if the line of code within the brackets are getting called. Pretty handy in the early stage of your project. After you finish the script you usually want to then delete all those debug.log and print() from your script to improve preformance.

avatar image sacajawhoohoo · Jul 26, 2015 at 01:38 PM 0
Share

Well I tried using that but realized that the level name of the quality setting would equate to the quality level, so ins$$anonymous$$d I used: (QualitySettings.currentLevel = QualityLevel.Fastest)

and got back these errors BCE0044: expecting ), found '='. BCE0043: Unexpected token: ).

So I tried using this ins$$anonymous$$d: if (QualitySettings.LevelName("Fastest"))

and got this long error: $$anonymous$$issing$$anonymous$$ethodException: UnityEngine.QualitySettings.LevelName Boo.Lang.Runtime.DynamicDispatching.$$anonymous$$ethodDispatcherFactory.ProduceExtensionDispatcher () Boo.Lang.Runtime.DynamicDispatching.$$anonymous$$ethodDispatcherFactory.Create () Boo.Lang.Runtime.RuntimeServices.DoCreate$$anonymous$$ethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args) Boo.Lang.Runtime.RuntimeServices.Create$$anonymous$$ethodDispatcher (System.Object target, System.String name, System.Object[] args) Boo.Lang.Runtime.RuntimeServices+c_AnonStorey15.<>m_9 () Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.Dispatcher$$anonymous$$ey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cache$$anonymous$$eyName, System.Type[] cache$$anonymous$$eyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cache$$anonymous$$eyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args) UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType)

1 Reply

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

Answer by Hexer · Jul 26, 2015 at 03:18 PM

That is strange, I have played with the code for a while with use of the unity reference and I made this script. (I made some mistake with saying LevelName, LevelName is not a member of QualitySettings so it didnt work. It should have been currentLevel. and you forgot to add another "=" ____1x"=" means Is. while 2x"=" mean is Equal to)

 using UnityEngine;
 using System.Collections;
 
 public class Test : MonoBehaviour {
 
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
         if (QualitySettings.currentLevel == QualityLevel.Fastest) {
             Application.LoadLevel ("1");
         } else 
             Application.LoadLevel ("2");
     }
 }

When I build and run this test project and put the quality to fastest. it would go to Apllication.LoadLevel("1"); and if some other quality was chosen, it would go to Application.LoadLevel("2");.

The same concept can also be applied to your script.

 if (QualitySettings.currentLevel == QualityLevel.Fastest) {
   object1.gameObject.SetActive(true);
 }
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 sacajawhoohoo · Jul 27, 2015 at 04:40 AM 0
Share

I thought I had tried that before but it didnt work, retried it and it did, idk, but thank you for the help!

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

22 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

Related Questions

Some quality settings not saving when altered in-game 0 Answers

HELP! Can't log in in one of my computers! 2 Answers

Animation won't play? Please help! 7 Answers

V Sync Count CAN'T be set in editor...??? New bug? 2 Answers

How to use the Unity Remote on Android? 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