using UnityEngine; using UnityEngine.UI; using System.Collections; public class ReplaySpeedBtn : MonoBehaviour { public Sprite[] spriteArr; public Image icon; public void OnClick() { int speed = Mathf.RoundToInt(GameTime.timeScale); if (speed == 1) { GameTime.timeScale = 2f; icon.sprite = spriteArr [1]; } else{ GameTime.timeScale = 1f; icon.sprite = spriteArr [0]; } } }