QualitySettings.SetQualityLevel() not recognised by Visual Studio

Hi everyone,

This is my first post here, sorry if I forget to post useful information that could help resolve this issue but I will try my best.

So I started creating an option menu in my 2D game for Android and when I got to the quality settings, I was not able to change it by script (C#) even if I copy/paste the script from the Unity Scripting API.

All I have is that this line of code is not recognised : QualitySettings.SetQualityLevel(int someQualityLevel);
Saying “Error CS0117 ‘QualitySettings’ does not contain a definition for ‘SetQualityLevel’

Maybe it is a dumb mistake I did but I really can’t figure out what the problem is…

I tried to google it but no one seems to have had an issue with that, I don’t want to report a bug before I know it is an issue to others.

Thanks for replying.

Can you post the full code for your script?

Thanks for the reply, here’s the code, it’s just a simple button to apply the quality settings the user chose :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ApplySettings : MonoBehaviour {
public GameObject optionPanel;
public Color clickColor;
public Color startColor;
public int qualityIndex;
private Text rend;
void Start()
{
rend = GetComponent();
}
void OnMouseDown()
{
rend.color = clickColor;
}
void OnMouseUp()
{
rend.color = startColor;
QualitySettings.SetQualityLevel(qualityIndex, true);
optionPanel.SetActive(false);
}
}

I have the Same Error here!

Unity 2017.2.0f3 (64-bit) not find the QualitySettings API

error CS0117: QualitySettings' does not contain a definition for antiAliasing’
error CS0117: QualitySettings' does not contain a definition for SetQualityLevel’

and so on…

I have no idea how to solved the problem…

It compiles just fine on my side.

You’ve probably created a script that’s named “QualitySettings”, which makes the names conflict.

2 Likes

Thank you Baste,
I indeed had a script named QualitySettings…
Problem solved :slight_smile:

Thanks again for your help!

1 Like