Skip to content

Avoid using Unity Debug for messages, warnings or errors, and create dedicated container for the required logs context.

License

Notifications You must be signed in to change notification settings

romanlee17/com.romanlee17.consolecontainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Console containers implementation for Unity

image

About

Avoid using Unity Debug for messages, warnings or errors, and create dedicated container for the required logs context.

Features and plans

  • Create containers for dedicated logs context.
  • Ability to manually control container lifetime.
  • Default "All" container which displays logs from all containers in order of their creation.
  • Display StackTrace of logs with ability to open IDE where log was made.

How to use

To create container, use method Create from ConsoleContainer:

// Without specifying container name.
IConsoleContainer console = ConsoleContainer.Create();

// With specifying container name.
IConsoleContainer console = ConsoleContainer.Create("Custom Container");

To create logs in the container, use methods below:

// Inside class instance, where "this." will be the name of the class which creates logs in the container.
console.CreateText(this, "Text message");
console.CreateWarning(this, "Warning message");
console.CreateError(this, "Error message");

// Inside static context, where "this." won't work.
console.CreateText(nameof(ClassName), "Text message");
console.CreateWarning(nameof(ClassName), "Warning message");
console.CreateError(nameof(ClassName), "Error message");

To dispose container after it is no longer needed (useful for editor extensions or when reloading domain is disabled when entering play mode):

console.Dispose();

How to install

To install this package, simply open Unity Package Manager,
click on the + icon and select "Add package from git URL...",
then paste the following URL: https://github.com/romanlee17/com.romanlee17.consolecontainer.git.

Requirements

  • Unity 2021.3 or later
  • UI Toolkit to display editor window

About

Avoid using Unity Debug for messages, warnings or errors, and create dedicated container for the required logs context.

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages