Unity3d package allowing the toggling of console output and debugging of UnityEvents.
Feedback is welcome.
- Open "Package Manager"
- Choose "Add package from git URL..."
- Use the HTTPS URL of this repository:
https://github.com/yanicksenn/unity-console.git#1.0.0 - Click "Add"
A console can be created through the asset menu > Create > Console > ... .
You can inject a console throught the inspector into your script.
Is is possible to use lazy logging or normal logging, although it is recommended to always use lazy logging inside of a script.
| Lazy logging | Normal logging |
|---|---|
LazyLog(() => ...) |
Log(...) |
LazyWarning(() => ...) |
Warning(...) |
LazyError(() => ...) |
Error(...) |
public class MyBehaviour : MonoBehaviour
{
public Console console;
private Start()
{
console?.LazyLog(() => "Hello, World!");
}
}Normal logging is recommended through a unity event.
public class MyBehaviour : MonoBehaviour
{
public UnityEvent unityEvent = new UnityEvent();
private Awake()
{
unityEvent.Invoke();
}
}After the untiy event was invoked the following output will appear in the editor console.
No messages will be printed to the console when it is set to inactive.
Active console
Inactive console
Lazy logging ensures that no messages are generated while normal logging always generates a message but will only print it when the console is active.




