So I was coding a resolution change setting but when i’ve done a loop for the UI on the screen many errors in the console appeared
the line is :
for (int i -0; i < resolutions.Lenght; i++)
and Unity tell me that the correct line would be :
for (int i ;-0; i < resolutions.Lenght); i++;})
I don’t understand how to fix it
Do someone have an idea ?
(I can show more details of the code or anythings if necessary)
Can you share Screenshots and code?
1 Like
You definitely have some malformed code before this code that is confusing the compiler.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class SettingsMenu : MonoBehaviour
{
public AudioMixer audioMixer;
public Dropdown resolutionDropdown;
Resolution[] resolutions;
public void Start()
{
resolutions = Screen.resolutions;
resolutionDropdown.ClearOptions();
List<string> options = new List<string>();
for (int i -0; i < resolutions.Lenght; i++)
{
string options = resolutions[i].width + "x" + resolutions[i].height;
options.Add(option);
}
resolutionDropdown.AddOptions(options);
}
public void SetVolume(float volume)
{
audioMixer.SetFloat("volume", volume);
}
public void SetFullScreen(bool isFullScreen)
{
Screen.fullScreen = isFullScreen;
}
}
You just need to replace - by = in your for loop.
Like this
for (int i = 0; i < resolutions.Lenght; i++)
Also resolutions.Lenght
should be resolutions.Length
2 Likes
It work ! Thank you so much I haven’t pay enough attention to these things.
1 Like