Reload level when dropdown option is changed.

l have 1 dropdown list and l want to reload the current scene whenever the selected option is changed.

l tried something like this: (which was a terrible idea)

void Update () {
		if(dropdown.value == 0){
			Application.LoadLevel(Application.loadedLevel);
		}
		if (dropdown.value == 1) {
			Application.LoadLevel(Application.loadedLevel);
		}
	}

but it reloads level every frame because Application.LoadLevel(Application.loadedLevel); is inside the Update(). if you have any ideas, please let me know.

UI.Dropdown has “onValueChanged” event:
https://docs.unity3d.com/ScriptReference/UI.Dropdown-onValueChanged.html

Easy to setup in inspector and then have code like:

 public void OnValueChanged()
    {
    Application.LoadLevel(Application.loadedLevel);
    }