using System.Collections; using UnityEngine; public class TimeMgr : MonoBehaviourSingletonTemplate { private void Start() { DontDestroy(); } public void Set_TimeScale(float delaytime = 0.025f, float _timescale = 0.05f) { StopCoroutine(nameof(Run_TimeScale)); StartCoroutine(Run_TimeScale(delaytime, _timescale)); } IEnumerator Run_TimeScale(float delaytime, float _timescale) { Time.timeScale = _timescale; yield return new WaitForSeconds(delaytime); Time.timeScale = 1f; } }