Advertisement
Guest User

Untitled

a guest
Apr 26th, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class DebugUI : MonoBehaviour
  8. {
  9. // Singleton
  10. public static DebugUI instance;
  11.  
  12. [SerializeField] Text debuginfo;
  13.  
  14.  
  15.  
  16. void Awake()
  17. {
  18. instance = this;
  19. }
  20.  
  21. void Start()
  22. {
  23. instance.debuginfo.text = "Debug";
  24. }
  25.  
  26.  
  27. public static void SetDebugText (string text)
  28. {
  29. instance.debuginfo.text = text;
  30. }
  31.  
  32. public static void AddDebugText (string text)
  33. {
  34. instance.debuginfo.text += text;
  35. }
  36.  
  37. public static void AddDebugLine (string text)
  38. {
  39. instance.debuginfo.text += text + "\n";
  40. }
  41.  
  42. public static void CleanDebugText()
  43. {
  44. instance.debuginfo.text = "";
  45. }
  46.  
  47. public static void EnableDebugText()
  48. {
  49. instance.debuginfo.enabled = true;
  50. }
  51.  
  52. public static void DisableDebugText()
  53. {
  54. instance.debuginfo.enabled = false;
  55. }
  56.  
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement