unity-coding-logging

Implement structured logging in Unity C# projects with UniT.Logging and DI.

Updated Aug 20, 2025
One-click install
npx skills add https://github.com/frostbun/dotfiles --skill unity-coding-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-coding-logging
Source: https://github.com/frostbun/dotfiles/tree/main/configs/opencode/skills/unity/unity-coding-logging
Command: npx skills add https://github.com/frostbun/dotfiles --skill unity-coding-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the integration of a powerful and flexible logging system into Unity C# projects, enabling better debugging and operational insights.

Core Features & Use Cases

  • ILogger Interface: Provides a standardized way to log messages at different levels (Debug, Info, Warning, Error, Critical, Exception).
  • Conditional Compilation: Log messages are only compiled in if the corresponding conditional symbol is defined, optimizing builds.
  • DI Integration: Seamlessly integrates with popular dependency injection frameworks like VContainer and Zenject.
  • Use Case: When developing a complex Unity game, use this skill to add detailed logging for player actions, system events, and potential errors, making it easier to track down bugs during development and in live builds.

Quick Start

Use the unity-coding-logging skill to get a logger for the current class and log an informational message.

Frequently Asked Questions about unity-coding-logging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured logging in Unity C#?

To implement structured logging in Unity C#, use the UniT.Logging package which provides an ILogger interface and UnityLogger implementation. This framework supports standardized logging levels including Debug, Info, Warning, Error, Critical, and Exception.

Can I use dependency injection to register loggers with VContainer or Zenject in Unity?

Yes, you can use dependency injection to register loggers with VContainer or Zenject in Unity. The UniT.Logging package integrates seamlessly with both DI frameworks, allowing automatic ILoggerManager and UnityLogger registration.

How do I configure log levels in Unity to optimize production builds?

You can configure log levels in Unity to optimize production builds using conditional compilation. Log messages are only compiled into the build if the corresponding conditional symbol is defined, stripping unnecessary debug logs automatically.

What is the best way to track down bugs in a complex Unity game?

The best way to track down bugs in a complex Unity game is to add detailed structured logging for player actions, system events, and potential errors. Using the UniT.Logging framework provides better debugging and operational insights for both development and live builds.

Does the Unity logging framework support different severity levels for system events?

Yes, the Unity logging framework supports different severity levels for system events. The LogLevel enum includes Debug, Info, Warning, Error, Critical, and Exception, providing a standardized way to categorize and filter logged messages.

How do I get a logger for the current class in Unity C#?

To get a logger for the current class in Unity C#, use the UniT.Logging skill's quick start feature. It integrates with your dependency injection container to inject an ILogger instance directly into your class for immediate logging.