ExecuteInEditMode
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.
@script ExecuteInEditMode()
var target :
Transform;
function Update () {
if (target)
transform.LookAt(target);
}
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class example :
MonoBehaviour {
public Transform target;
void Update() {
if (target)
transform.LookAt(target);
}
}
import UnityEngine
import System.Collections
[ExecuteInEditMode]
class example(
MonoBehaviour):
public target as
Transform def
Update():
if target:
transform.LookAt(target)