Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

ExecuteInEditMode

class in UnityEngine

マニュアルに切り替える

説明

スクリプトを Edit モードで実行します

デフォルトでは、スクリプトコンポーネントは Play モードでのみ実行されます。 この属性を追加することでそれぞれのスクリプトコンポーネントはエディターが Play モードでないときにコールバック関数が実行されます。

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 や他のレンダリングコールバック関数はシーンビューまたはゲームビューの再描画の都度、呼び出されます。

using UnityEngine;
using System.Collections;

[ExecuteInEditMode] public class ExampleClass : MonoBehaviour { public Transform target; void Update() { if (target) transform.LookAt(target); } }