using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class TimescaleAdjuster : MonoBehaviour { public Button nextBtn; public Button prevBtn; public TMP_Text txt; void Start() { nextBtn.onClick.AddListener(IncrementTime); prevBtn.onClick.AddListener(DecrementTime); UpdateText(); } void IncrementTime(){ if(Time.timeScale < 0.25f){ Time.timeScale = 0.25f; }else{ Time.timeScale += 0.25f; } UpdateText(); } void DecrementTime(){ if(Time.timeScale > 0.25f){ Time.timeScale -= 0.25f; }else{ Time.timeScale *= 0.5f; } UpdateText(); } void UpdateText(){ txt.text = Time.timeScale.ToString("n2"); } }