Advertisement
Pro_Unit

BillboardItem

Sep 16th, 2023
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using TMPro;
  2.  
  3. using UnityEngine;
  4.  
  5. namespace UIBillboard
  6. {
  7.     [RequireComponent(typeof(TextMeshProUGUI))]
  8.     public class BillboardItem : MonoBehaviour
  9.     {
  10.         [field:SerializeField] public string Name { get; internal set; }
  11.  
  12.         [SerializeField] private TextMeshProUGUI _text;
  13.  
  14.         private void OnValidate() =>
  15.             _text ??= GetComponent<TextMeshProUGUI>();
  16.  
  17.         public void SetValue(string value) => _text.text = $"{Name}: {value}";
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement