Add script throug UI for execution

Hi,
I am trying to create a script which will render a GUIButton where you can specify margin, position on the screen for that button, texture and action that will be executed. I created everything except this part where you can drop script you wrote so that it’s function can be executed when you click on button. Basically I want to made it easy so that you can drop script in field (something simmilar like skybox is functing or when you create an empty object and drop script in it). Can you point me into right direction or if you have already simmilar solution to help me with.
the code should looks something like

public ScriptOrSomeOtherObject ScriptForExecution;

if(ScriptForExecution != NULL/EMPTY/OR_SOMETHING)
{
ScriptForExecution.RunSomehow();
}

(I need this for c#, I could maybe create a javascript but C# is targeted for other reasons)

Thank you!!!

There is a way in which you drag a script and select a method to be executed from that script. This however in most cases will requires writing custom editor which will expose delegates. Luckily there is a free package in asset store that does that for you https://www.assetstore.unity3d.com/en/#!/content/6289

If you want to keep is simple, you could drag script (you need to know the type), pass method (courutine) in String and call it via startCourutine, or even simpler sendMessage.

Here you cave example how to do it using custom editor
http://answers.unity3d.com/questions/474348/can-you-assign-serializable-delegates-in-the-inspe.html