using switch case statement on button to load scenes

Hi I want to use switch-case statement on 1 button that will get the value of my Level Label as its value to load scenes but i don’t know how to do that can someone help me?

    public void LoadScene(string name)
{
        Application.LoadLevel (name);
}

Im assuming you are using the new UI system. Im not entirely sure how you can go about doing it like you explained but ill try my best to help you :slight_smile:

Ok so, I dont fully understand your question… but ill show you how you can add functionallity to buttons dynamicly and that will lead you towards what you are aiming for :slight_smile:

    public Button btn;


    void Start ()
    {
        AddButtonListeners();
    }


    //ONLY CALL THIS ONCE!!!
    void AddButtonListeners ()
    {
        //ALTERNATIVE 1
        btn.onClick.AddListener(delegate () { LoadScene();
        });

        //ALTERNATIVE 2
        btn.onClick.AddListener(() =>
        {
            LoadScene();
        });
    }

    void LoadScene ()
    {
        //LOAD LEVEL HERE
    }