ExecuteInEditMode Manual     Reference     Scripting  
Scripting > Attributes > ExecuteInEditMode
ExecuteInEditMode Class, inherits from Attribute

Makes a script execute in edit mode.

By default scripts are only executed in playmode. By adding this attribute, each script instance will always have its Update, FixedUpdate, and OnGUI functions executed every frame while the Editor is running.

// Make the script also execute in edit mode.
@script ExecuteInEditMode()

// Just a simple script that looks at the target transform.
var target : Transform;
function Update ()
{
if (target)
transform.LookAt(target);
}