お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseUpdateはMonoBehaviourが有効の場合に、毎フレーム呼び出されます
Updateは様々なゲーム動作の実装において最もよく使われる関数です。
// Moves the object forward 1 meter a second function Update () { transform.Translate(0, 0, Time.deltaTime * 1); }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Update() { transform.Translate(0, 0, Time.deltaTime * 1); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Update() as void: transform.Translate(0, 0, (Time.deltaTime * 1))
最後にUpdateを呼び出してからの経過時間を得るにはTime.deltaTimeを使用します。 この関数は Behaviour が有効化されている場合のみ呼び出しされます。 独自にコンポーネントの機能を加える場合、この関数をオーバーライドして下さい。