A switch expression of type `method group' cannot be converted to an integral type.........

I’m trying to update my old script because I have the obsolete warning thing showed up in the console that I have to change 'QualitySettings.currentLevel to GetQualityLevel or SetQualityLevel. I changed it and now this error came up in the console.

I’m a newbie programmer and I’m still learning C# :slight_smile:

Here’s my code:

using UnityEngine;
using System.Collections;

public class ChangeTerrainQuality : MonoBehaviour {
    enum QualityLevel
    {
        Fastest,
        Fast,
        Simple,
        Good,
        Beautiful,
        Fantastic,
    }

    void Start() {
        UpdateQuality();
    }

    void UpdateQuality() {
        Debug.Log("Changing...");

        switch (QualitySettings.GetQualityLevel) {
            case QualityLevel.Fastest:
                Terrain.activeTerrain.treeDistance = 250.0f;
                Terrain.activeTerrain.treeBillboardDistance = 30.0f;
                Terrain.activeTerrain.treeCrossFadeLength = 5.0f;
                Terrain.activeTerrain.treeMaximumFullLODCount = 5;

                Terrain.activeTerrain.detailObjectDistance = 30.0f;

                break;

            case QualityLevel.Fast:
                Terrain.activeTerrain.treeDistance = 500.0f;
                Terrain.activeTerrain.treeBillboardDistance = 50.0f;
                Terrain.activeTerrain.treeCrossFadeLength = 10.0f;
                Terrain.activeTerrain.treeMaximumFullLODCount = 10;

                Terrain.activeTerrain.detailObjectDistance = 40.0f;

                break;
      }
   }
}

switch (QualitySettings.GetQualityLevel () ) {

The extra () makes it actually execute, otherwise its just a reference to a method

Thanks for the help John, but now I got this error.

I’m a bit slow on how to create a cast.

Oh nevermind. I did the casting at QualityLevel so it became (int)QualityLevel.Fastest . Thanks for the help ! :slight_smile: