> 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/main-components/fish-catcher.md).

# Fish Catcher

Manages caught fish: spawns, hides, and tracks them using object pooling. Designed to work with animation events and fishing state machines.

> ✅ **Requires**: A parent `MAnimal` (from Malbers Animations) — it uses the left hand bone to hold fish.

***

#### 🔧 Inspector Settings

* **Fish Count**\
  Reference to an `IntReference` that tracks total fish caught. Automatically incremented when a fish is despawned (e.g., after presentation).
* **Fishing End Presentation Event**\
  Triggered when fishing ends *and* a fish is being presented. Useful for cleanup or UI updates.
* **On Fish Presented**\
  Unity event fired when `FishPresentation()` is called. Hook animations, sounds, or UI here.

***

#### 📈 Public Methods

* `HandleFishCatched(FishData fishData)`\
  Caches or instantiates the fish prefab from the given `FishData` and prepares it for display (inactive by default).
* `SpawnFish()`\
  Activates the current fish in the left hand.
* `DespawnFish()`\
  Hides the fish and increments the fish count. Called automatically at the end of a fishing sequence if a fish was presented.
* `FishPresentation()`\
  Marks that a fish is being shown (e.g., during a victory pose). Triggers `OnFishPresented`.
* `HandleFishingEnd()`\
  Called externally (e.g., by a state machine) when fishing ends. If a fish was presented, it fires the `FishingEndPresentationEvent` and despawns the fish.
* `ClearFishPool()`\
  Destroys all pooled fish objects. Called automatically on destroy


---

# 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/main-components/fish-catcher.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.
