1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Unity】 Time.time / Time.deltaTime / Time.timeScale 違い

Posted at

はじめに

Time関係の変数を使う時にいつも何を使えば良いのか混乱するのでまとめておきました。

それぞれの意味

Time.time:
ゲーム開始時 から 現在までの経過時間(秒)を表す。
プレイ時間を表す時に使う。

Time.deltaTime:
前回のフレーム からの 経過時間(秒)を表す。

Time.timeScale:
現実世界とUnity内の時間があるとすると、Unity内の時間経過 表す。
初期値=1であり、1の時に現実世界の時間と等しい。
0=止まる 0.5=1/2倍速 2=2倍速

的した場面(一例)

Time.time:
長い時間を計測したい場合
ゲーム開始時からの経過時間を取得したい場合

Time.deltaTime:
処理を時間単位で行いたい場合
一時停止をしたい場合
短めの時間を計測したい場合(Time.timeでも良いがdeltaTimeの方が記述が簡単)

Time.timeScale:
スローモーションにしたい場合
クイックモーションにしたい場合

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?