Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Suggest a change


Namespace: UnityEngine


Makes a script execute in edit mode.

By default, script components are only executed in play mode. By adding this attribute, each script component will also have its callback functions executed while the Editor is not in playmode.

The functions are not called constantly like they are in play mode.
- Update is only called when something in the scene changed.
- OnGUI is called when the Game View recieves an Event.
- OnRenderObject and the other rendering callback functions are called on every repaint of the Scene View or Game View.

// 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); }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Transform target;
    void Update() {
        if (target)
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public target as Transform

	def Update() as void:
		if target:

Your name (optional):
Your email (optional):
Please write your suggestion here: