Events for EditorGUILayout.Popup

I have been using EditorGUILayout.Popup for creating dropdown in EditorWindow script. I have requirement to create these Dropdown for a folder depth on selection, so are there any events like “OnSelectedvalueChanged()” that we can use to fire an event??

or any suggestion how to write a custom event would be helpful.

Regards,

Jithendra.

you can track the change in the OnInspectorUpdate method, it is called 10 times per second.

int index = 0;
int newindex = 0;
string[] jointsList = new string[] { "Fixed Joint", "Character Joint", "Hinge Joint", "Spring Joint" };

void OnGUI()
{
     index = EditorGUILayout.Popup(index, jointsList);
}
private void OnInspectorUpdate()
    {
        if (newindex != index)
        {
            newindex = index;
            OuChagePopup();
        }
    }
void OuChagePopup()
{
        // you code
}