- Home /
Set Quality With Dropdown
Currently, I'm working on a script for my main menu settings. I've been stuck at the quality setting for hours, trying to figure the problem out. I have 6 quality levels: Very low, Low, Medium, High, Very High, Ultra and i'm trying to change the quality through a TextMeshPro dropdown. I am getting 2 errors: Identifier Expected and Syntax error, ',' expected. Here's the script so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
using TMPro;
public class SettingsMenu : MonoBehaviour {
public AudioMixer audioMixer;
public void SetVolume(float volume)
{
audioMixer.SetFloat("volume", volume);
}
public void MusicVolume(float volume)
{
audioMixer.SetFloat("music", volume);
}
public void SetQuality(int 0)
{
QualitySettings.SetQualityLevel(0);
}
}
Thanks in advance.
Answer by finnjwohner · Jul 17, 2020 at 01:44 PM
Just glancing at the code, I see that you're using 0 as a variable for the SetQuality() function, variable names cannot start with a number, perhaps choose something else like i, or index.
I'm Pretty New To Scripting, and kinda dumb, and i don't understand what u want me to do. Would u please explain more, or send the code? Thank u