LoginSignup
2
3

More than 5 years have passed since last update.

一時停止機能の作成

Last updated at Posted at 2018-07-17

Time.timeScaleによる一時停止機能。
アイテム画面の閲覧中などに使えるかもしれません。
使い勝手は良くないです。←

いや、正直アニメーションを個別に止めたりするほうがまだ楽な気がします・・・

注意点:Update関数内のものは止まりません。止めたいものはFixedUpdate内へ記述しましょう。

Pause.cs
using UnityEngine;

public class Pause : MonoBehaviour {

    //どこからでもアクセスしたく、staticにしました
    public static bool isPaused;

    private void Update()
    {
        if(isPaused){
            Time.timeScale = 0f;
        }else{
            Time.timeScale = 1f;
        }
    }
}
2
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
2
3