> For the complete documentation index, see [llms.txt](https://sunfish-studios.gitbook.io/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sunfish-studios.gitbook.io/main/secondary-components/ui-logger.md).

# UI Logger

<figure><img src="/files/3lJO5jaQGeXABQF7fpnb" 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="/files/w8CDa9hy4Jj2pjSOg7Wu" 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).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sunfish-studios.gitbook.io/main/secondary-components/ui-logger.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
