Custom Editor: Inspect members of GameObject

I’m trying to achieve the same functionality as the OnClick() on the Button Script in the UNITY UI. I want to be able to add a GameObject in the inspector, and then select a script that is attached to that object and then select a variable or function from that script.

This picture illustrates what I want:
39608-27-01-2015-06-43-37.png

So far I have been able to add an object to the inspector and add all scripts from that object to an array, my code looks like this:

[CustomEditor(typeof(BarScript))]
public class LevelScriptEditor : Editor
{
    //Array that holds all scripts
    private MonoBehaviour[] scripts;

    public override void OnInspectorGUI()
    {
        //Creates a reference to the target
        BarScript myBarScript = (BarScript)target; 

        //Set's the barscript's object to the object that we just dragged onto the inspector
        myBarScript.ObjectToMonitor = (GameObject)EditorGUILayout.ObjectField(myBarScript.ObjectToMonitor, typeof(GameObject), true);

        //Stores all scripts on the object in the MonoBehaviour array
        scripts = myBarScript.ObjectToMonitor.GetComponents<MonoBehaviour>();
    }
}

This is what the array contains:

39609-gg.png

My question is. How do I show the names of these scripts in the inspector and expose the members of these scripts, so that they can be selected from the inspector?

That functionality is exposed from Unity. No need to make your own solution. You just need to create a UnityEvent variable in your script. Then you will have the same functionality:

using UnityEngine;
using System.Collections;

public class EventsExample : MonoBehaviour 
{
    public UnityEngine.Events.UnityEvent onClick;

    private void OnMouseDown()
    {
        onClick.Invoke();
    }
}

Use Type.IsSubclassOf to get all classes that the specified object derives from. Then find all methods and store them as Method Info. Then you can invoke them from that method info anytime you want just by specifying a object reference and parameters;

List<System.Reflection.MethodInfo> infos = new List<MethodInfo>();

                foreach (System.Reflection.Assembly ass in System.AppDomain.CurrentDomain.GetAssemblies())
                {
                    foreach (System.Type type in ass.GetTypes())
                    {
                        if(typeof(MyType).IsSubclassOf(type))
                        {
                            foreach(System.Reflection.MethodInfo info in type.GetMethods(BindingFlags.Instance))
                            {
                                infos.Add(info);
                            }
                        }
                    }
                }