error CS0200 how to fix it?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class VideoandAudio : MonoBehaviour
{
public Toggle fulltog, vtog;
public List resolutions = new List();
private int selectedResolution;
public TMP_Text resolutionLabel;
// Start is called before the first frame update
void Start()
{
fulltog.isOn = Screen.fullScreen;
if (QualitySettings.vSyncCount == 0)
{
vtog.isOn = false;
} else
{
vtog.isOn = true;
}
bool foundRes = false;
for(int i = 0; i < resolutions.Count; i++)
{
if (Screen.width = resolutions_.horizontal + Screen.height == resolutions*.vertical) ;_
_
{_
foundRes = true;
selectedResolution = i;
UpdateResLabel();
_
}_
_
}_
_
}_
_
// Update is called once per frame*_
void Update()
{

}
public void resleft()
{
selectedResolution–;
if(selectedResolution < 0)
{
selectedResolution = 0;
}
UpdateResLabel();
}
public void resright()
{
selectedResolution++;
if (selectedResolution > resolutions.Count - 1)
{
selectedResolution = resolutions.Count - 1;
}
UpdateResLabel();
}
public void UpdateResLabel()
{
resolutionLabel.text = resolutions[selectedResolution].horizontal.ToString() + " x " + resolutions[selectedResolution].vertical.ToString();
}
public void ApplyChanges()
{
Screen.fullScreen = fulltog.isOn;
if (vtog.isOn)
{
QualitySettings.vSyncCount = 1;
}
else
{
QualitySettings.vSyncCount = 0;
}
Screen.SetResolution(resolutions[selectedResolution].horizontal, resolutions[selectedResolution].vertical, fulltog.isOn);
}
}
[System.Serializable]
public class ResItem
{
public int horizontal, vertical;
}

The code seems to have a typo error in line 32. The conditional statement should be using “==” for comparison, not “=” which is used for assignment. So, the correct code would be:

if (Screen.width == resolutions[i].horizontal && Screen.height == resolutions[i].vertical)
{
    foundRes = true;
    selectedResolution = i;
    UpdateResLabel();
}

Also, there is a semicolon after the conditional statement, which would make the following block always execute regardless of the condition. This semicolon should be removed.

thank you very much

I know you’ve been asked this previously so, in the future, please use code-tags when posting code and not plain text. At least then there’s line numbers to refer to.

Also, don’t post the error codes, post the error description and line/column numbers i.e. the full error you are provided. The error code alone isn’t useful.

Thanks.

1 Like