# UI Logger

<figure><img src="https://2707882048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7extQzUzohv5ZZCgCVG8%2Fuploads%2FuBl51oSmTmN5HrWqrfxS%2FUI%20Logger.gif?alt=media&#x26;token=8306234f-b227-438c-bf6b-d618c3b9c356" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2707882048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7extQzUzohv5ZZCgCVG8%2Fuploads%2FxSbO6qT71ih44ydi4vFT%2Fimage.png?alt=media&#x26;token=78b6cd3a-a17d-41d7-b9b1-7e2b994f8a22" alt="" width="380"><figcaption></figcaption></figure>

**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).
