ButtonData.cs 637 B

12345678910111213141516171819202122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using TMPro;
  6. using Sirenix.OdinInspector;
  7. namespace KairoEngine.UI.InteractionHandler
  8. {
  9. [HideMonoScript]
  10. public class ButtonData : MonoBehaviour
  11. {
  12. public TextMeshProUGUI headerComponent;
  13. public Image graphicComponent;
  14. public void Setup(string text, Sprite graphic = null)
  15. {
  16. if(headerComponent != null && !string.IsNullOrEmpty(text)) headerComponent.text = text;
  17. if(graphic != null && graphicComponent != null) graphicComponent.sprite = graphic;
  18. }
  19. }
  20. }