LoginSignup
6
3

More than 5 years have passed since last update.

Awake,Start,Updateって何やねん(Unity初心者メモ)

Posted at

Awake

自身の変数の初期化に使う。すべてのオブジェクトのインスタンス生成後に呼び出されるので、GameObject.findWithTagで対象の参照を取得できる。

ただし、オブジェクト毎のAwakeの実行順序は決まってないので、情報の取得は行うべきではない。まだ情報が確定していないため。

Start

情報の取得は全Awakeが終わった後に呼び出されるStartを使うべき。またAwakeはスクリプトがアクティブじゃなくても呼び出される。

Update

Updateは毎フレームで繰り返し呼ばれる処理を書く。StartはUpdateの初回に一度だけ呼ばれる。

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3