UnityEssentials
Small but useful tools and features for Unity
ConsoleTMP.cs
Go to the documentation of this file.
1 using System;
2 using TMPro;
3 
4 namespace UnityEngine
5 {
9  [RequireComponent(typeof(TMP_Text))]
10  public class ConsoleTMP : Console
11  {
15  [NonSerialized] public TMP_Text textTMP;
16 
17  protected override void UpdateVisuals()
18  {
19  if (textTMP == null)
20  textTMP = gameObject.GetComponentRequired<TMP_Text>();
21 
22  textTMP.enabled = show;
23 
24  if (!show)
25  return;
26 
27  textTMP.text = fullLog;
28  }
29 
30  }
31 }
Base class to handle the console display in-game
bool show
If the console must be displayed or not.
string fullLog
The log messages of the console.
Component to display the console (debug logs) in-game using a TMP_Text component
Definition: ConsoleTMP.cs:11
TMP_Text textTMP
The TMP_Text component that is going to be updated to display all the log messages.
Definition: ConsoleTMP.cs:15
override void UpdateVisuals()
Updates the visuals of the console
Definition: ConsoleTMP.cs:17