Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

What am I doing wrong in this script?

I've been following the latest How to make a game tutorial and decided to implement the Menus tutorial and I'm Stuck in the settings Menu, specifically in the resolution dropdown, I tried to make the script exactly the same as the tutorial but it keeps telling me that Lenght isn't a recognized.

"Assets\Scripts\SettingsMenu.cs(25,41): error CS1061: 'Resolution[]' does not contain a definition for 'Lenght' and no accessible extension method 'Lenght' accepting a first argument of type 'Resolution[]' could be found (are you missing a using directive or an assembly reference?)"

I have tried everything and I think I need help.

This is my Script:

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;


  void Start ()

  {

    resolutions = Screen.resolutions;


    resolutionDropdown.ClearOptions();


    List<string> options = new List<string>();



    // no reconoce lenght


    for (int i = 0; i < resolutions.Lenght; i++)

    {

      string option = resolutions[i].width + "x" + resolutions[i].height;

      options.Add(option);

    }


    resolutionDropdown.AddOptions(options);

  }


  public void SetVolume(float volume)

  {

    audioMixer.SetFloat("volume", volume);

 

  }

  public void SetQuality (int qualityIndex)

  {

    QualitySettings.SetQualityLevel(qualityIndex);

  }

}

Answers

Sign In or Register to comment.