using System.Collections.Generic; using UnityEngine; public class LogGUI : MonoBehaviour { private string _log = string.Empty; private readonly Dictionary> _trackedInt = new Dictionary>(); private readonly Dictionary> _trackedFloat = new Dictionary>(10); public void Log(object message) { _log += message; } public void Track(object message, ValueWrapper target) { if (target is ValueWrapper intValue) _trackedInt.Add(message.ToString(), intValue); else if (target is ValueWrapper floatValue) _trackedFloat.Add(message.ToString(), floatValue); else return; } private void OnGUI() { GUILayout.Label(_log, GetStyle()); foreach (KeyValuePair> item in _trackedInt) GUILayout.Label($"{item.Key} {item.Value.Value}", GetStyle()); foreach (KeyValuePair> item in _trackedFloat) GUILayout.Label($"{item.Key} {item.Value.Value}", GetStyle()); } private GUIStyle GetStyle() { return new GUIStyle { fontSize = 30 }; } }