UnityEssentials
Small but useful tools and features for Unity
ConsoleTextUI.cs
Go to the documentation of this file.
1 using System;
2 using UnityEngine.UI;
3 
4 namespace UnityEngine
5 {
9  [RequireComponent(typeof(Text))]
10  public class ConsoleTextUI : Console
11  {
15  [NonSerialized] public Text textUI;
16 
17  protected override void UpdateVisuals()
18  {
19  if (textUI == null)
20  textUI = gameObject.GetComponentRequired<Text>();
21 
22  textUI.enabled = show;
23 
24  if (!show)
25  return;
26  textUI.text = fullLog;
27 
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 Text component
Text textUI
The Text component that is going to be updated to display all the log messages.
override void UpdateVisuals()
Updates the visuals of the console