LoginSignup
0
0

More than 3 years have passed since last update.

Unityゲームの停止と最初から

Posted at

起こった事

ゲームのリトライを行った時に全てのオブジェクトが停止した状態になっていた

リトライのコード

SceneManager.LoadScene(0);

また、全てのオブジェクトのstart()などは正常に動作していた。

エラー原因のコード

ゲーム終了時の停止処理で以下のコードを実行していた

Time.timeScale = 0.0f; //時間停止

これが内部的にはstaticな値のようで、ゲームをリトライする前には時間停止を解除する必要があるようだった。

解決策

以下のコードでリトライ処理を行なった

Time.timeScale = 1.0f; //時間起動
SceneManager.LoadScene(0); //シーンの再読み込み
0
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
0
0