Unity DropDown.OnValuechanged not working

I am trying to add a dropdown to a scene where the user selects an option and it updates the playerprefs and when app restarts, the selected option on the dropdown should be the one previously selected by the user.

The code I have come up with so far is as follows.

public Dropdown mViewerTypeDropDown;
    void Start () {
        mDebug = (LRDebug)mScriptHolder.GetComponent<LRDebug> ();
        mScriptHolder=GameObject.Find ("ScriptHolder");
        mViewerTypeDropDown.captionText.text = PlayerPrefs.GetString ("Viewer Type","Generic Cardboard (Default)");

    }
//The Function attached to onvaluechanged listner
public void ViewerTypeChanged(int value)
    {

        mViwerTypeChange = value;

        switch (mViwerTypeChange) {
        case 0:
            mViewerType = "Generic Cardboard (Default)";
            break;
        case 1:
            mViewerType="VR ONE (Zeiss)";
            break;
        case 2:
            mViewerType="VR Goggles (Merge)";
            break;
        case 3:
            mViewerType="C1-Glass (Go4D)";
            break;
        case 4:
            mViewerType="Cardboard v1 (Google)";
            break;
        }

        PlayerPrefs.SetString("Viewer Type",mViewerType);
        PlayerPrefs.Save ();
    }

This seems logically right to me but I am not sure of what I am missing here. And to be further clear I have made the attached method a dynamic one in the editor as follows
69691-screen-shot-2016-05-09-at-95155-am.png

I have searched a lot but as this dropdown option is a new one There are not many examples out yet. So as a unity newbie I cannot seem to work this one out. If anyone could help me with this it will be a great help. thank you

Hi Achala,

I wonder if you have found a solution for this problem because I’m having the same issue and could not get it working even after thorough research on the internet. The problem is, no matter what option I select, the value won’t change from 0. That is not how it’s supposed to be working I guess?

Instead of passing an integer value to the listener, try passing a Dropdown object, and in the editor choose the Dropdown to be passed to the listener. Then you can get the value of that Dropdown in your code. For example:

public void dropdownListener(Dropdown dd) { mViwerTypeChange = dd.value; }