TextNotificationCenter.cs 482 B

123456789101112131415161718
  1. using UnityEngine;
  2. public class TextNotificationCenter : MonoBehaviour
  3. {
  4. [SerializeField]
  5. private TextNotification textNotificationPrefab;
  6. private TextNotification currentNotification;
  7. public void ShowNotification(string message)
  8. {
  9. if(currentNotification != null)
  10. currentNotification.CloseNotification();
  11. currentNotification = Instantiate(textNotificationPrefab, transform);
  12. currentNotification.Setup(message);
  13. }
  14. }