🖨️UI Logger

A singleton UI utility that displays temporary, auto-fading log messages in-game—ideal for debugging, player feedback, or event notifications during fishing (e.g., “Fish nibbled!”, “Fish bitting!”).


🔧 Inspector Settings

References

  • Log Container The parent Transform where log entries are spawned (should use a layout group for automatic stacking).

  • Log Prefab A Text prefab used to instantiate each log line. Must be a UI Text component.

Fade Settings

  • Fade In Duration Time (in seconds) for a new log entry to fade in.

  • Active Time How long the log remains fully visible before fading out.

  • Fade Out Duration Time (in seconds) for the log to fade out before being destroyed.


💡 Usage

From anywhere in your code, log a message like this:

UILogger.Log("Fish escaped!", "red");

  • If no color is specified, it uses the prefab’s default text color.

  • Messages are automatically cleaned up after fading out.

⚠️ Note: Ensure the Log Prefab is a UnityEngine.UI.Text object and is disabled in the prefab (it will be activated on spawn).

Last updated