MessageView.cs no animation

This commit is contained in:
s-prechtl 2022-06-10 08:54:53 +02:00
parent 6d8233f33f
commit 6f8f58566c
3 changed files with 27 additions and 17 deletions

View file

@ -23,7 +23,18 @@ public class MessageView : MonoBehaviour
public GameObject messageView;
public TextMeshProUGUI message;
public void sendMessage(String msg, double duration) {
private void Start() {
messageView.SetActive(false);
}
public void sendMessage(String msg, float duration) {
message.text = msg;
StartCoroutine(showForSeconds(duration));
}
private IEnumerator showForSeconds(float duration) {
messageView.SetActive(true);
yield return new WaitForSeconds(duration);
messageView.SetActive(false);
}
}