Logpad
A panel used to show variables.
Tools/Wonderland/Editor Tools/Logpad
Note: primitives variables need to be update manually, dictionary and other classes can be set to Logpad 1 time.
Example
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using EODE.Wonderland;
public class Test : MonoBehaviour {
int _testint = 0;
Dictionary<string, Vector2> _testdict = new Dictionary<string, Vector2>();
void Start() {
Logpad.Log("SectionTest.hello", "Hey you !");
Logpad.Log("SectionTest.variable2", new Vector3(4f, 8.5f, 4.68f));
Logpad.Log("Section2Test.A random Vector3", new Vector3(7f, 45.5f, 1.68f));
Logpad.Log("Section2Test.An array", new byte[] { 1, 4, 8, 9, 15, 23, 4 });
Logpad.Log("Section2Test.An array 2", new string[] { "première valeur", "seconde", "troisième", "quatrième" });
_testdict["Up"] = Vector2.up;
_testdict["Right"] = Vector2.right;
_testdict["Down"] = Vector2.down;
_testdict["Left"] = Vector2.left;
Logpad.Log("Section2Test.My dictionary", _testdict);
}
void Update() {
Logpad.Log("SectionTest.update counter", ++_testint);
_testdict["Left"] = _testdict["Left"] * (new Vector2(1.01f, 0f));
}
}
Remove variables
// Remove variable
Logpad.Remove("SectionTest.update counter");
// Remove section
Logpad.Remove("SectionTest.");
Actions
Create a button to execute a System.Action. This Action is stored by Logpad to prevent garbage collection. (other variables use a WeakReference)
Logpad.Log("Test", () => {
Debug.Log("Test button");
});
Time debug
Usefull to log execution times.
IEnumerator timetestRoutine() {
while (true) {
Logpad.Time("Time test.test 1.AAAAA", new Color(1f, 0f, 1f));
yield return new WaitForSeconds(2f);
Logpad.Time("Time test.test 1");
yield return new WaitForSeconds(1f);
Logpad.Time("Time test.test 1.BBBBBB", new Color(0f, 1f, 1f));
yield return new WaitForSeconds(3f);
}
}
Auto pause after 15s
Logpad.Time("Time test.test 1.AAAAA", new Color(1f, 0f, 1f), 15f);
Append a custom section
using EODE.Wonderland;
using UnityEngine;
using UnityEditor;
namespace MyProject {
public class LogpadMyCustomSection : LogpadWindow.ISection {
[InitializeOnEnterPlayMode]
static public void Init() {
LogpadWindow.CustomSections["MyCustomSection"] = new LogpadMyCustomSection();
}
Dictionary<string, Texture2D> _icons = null;
public bool IsEnabled() {
// show or hide this section
}
public void Draw() {
// draw editor content
}
}
}