public void showToast(string message, bool autoHide = true) { alertMessage.text = message; time = Time.time; this.autoHide = autoHide; showsToastStatus = ShowToastStatus.Show; }
// Update is called once per frame void Update() { if (showsToastStatus == ShowToastStatus.Show) { if (time + DelayTimeToHide < Time.time && autoHide) { time = Time.time; showsToastStatus = ShowToastStatus.Hidding; } } else if (showsToastStatus == ShowToastStatus.Hidding) { if (alertMessage.text.Length == 0){ showsToastStatus = ShowToastStatus.Hide; } else { if (time + SpeedHide < Time.time) { alertMessage.text = alertMessage.text.Remove(alertMessage.text.Length-1); time = Time.time; } } } }
// Use this for initialization void Start() { alertMessage.text = string.Empty; showsToastStatus = ShowToastStatus.Hide; }
public void hideToast() { time = Time.time; showsToastStatus = ShowToastStatus.Hidding; }