Current version 1.5.0.08.26

Documentation

API Reference

Integrate FishingSystem, FishingRod, FishingFloat, loot, bait, input, and the example player through their public C# API.

Fishing Game Tool exposes its core fishing state through runtime components and ScriptableObject data. Editor-only rod building and documentation types are compiled from Editor folders and must not be referenced by runtime assemblies.

Many serialized fields retain their original underscore-prefixed names for prefab and scene compatibility. For new runtime integrations, prefer the public properties and methods described below instead of writing directly to transient state fields.

Namespaces

Core runtime namespaces:

  • FishingGameTool.Fishing
  • FishingGameTool.Fishing.Rod
  • FishingGameTool.Fishing.Float
  • FishingGameTool.Fishing.Line
  • FishingGameTool.Fishing.Loot
  • FishingGameTool.Fishing.LootData
  • FishingGameTool.Fishing.BaitData
  • FishingGameTool.Fishing.CatchProbability

Optional example namespace:

  • FishingGameTool.Example

Editor namespace:

  • FishingGameTool.Editor
  • FishingGameTool.Editor.Documentation

Unity version compatibility

The public API documented below is identical in Unity 2022.3.4f1 and newer, including Unity 2023 and Unity 6. Project integrations should use the same FishingSystem, FishingRod, FishingFloat, data, and example APIs in every supported editor.

Rigidbody velocity differences are handled internally:

  • Unity 2022 and Unity 2023 compile against Rigidbody.velocity.
  • Unity 6 compiles against Rigidbody.linearVelocity.

Do not add editor-version checks around calls to the Fishing Game Tool public API. When custom project code directly reads or writes Rigidbody velocity, that project code remains responsible for selecting the API available in its target Unity version.

InputHandler requires the Unity Input System. Version 1.4.3 is the validated minimum baseline for Unity 2022.3.4f1; newer editors should use a compatible package version supplied through Package Manager.

FishingSystem

Namespace: FishingGameTool.Fishing

FishingSystem coordinates input, casting, float movement, catch checks, loot selection, line state, rewards, and reset.

State properties

  • InputController: assigned InputHandler
  • FishingRod: assigned FishingRod
  • CurrentBait: current FishingBaitData or null
  • CaughtLootData: current FishingLootData or null
  • CurrentFloat: active float Transform or null
  • IsFishing: true while a cast is pending or a float exists
  • HasCaughtLoot: true after a catch succeeds
  • CanCast: true when a rod exists, no cast is pending, no float exists, and the line is not broken

Control methods

  • ResetFishing(): cancels a pending cast, destroys the active float, clears catch and line runtime state, resets rod bending, and clears the pathfinder.
  • ForceStopFishing(): compatibility alias for ResetFishing.
  • RepairFishingLine(): clears the broken-line state when a rod is assigned.
  • FixFishingLine(): compatibility alias for RepairFishingLine.

ResetFishing does not repair the line. This allows a broken line to remain a gameplay state until the project explicitly repairs it.

Bait methods

  • SetBait(FishingBaitData): directly assigns bait without spawning the previous bait prefab.
  • ClearBait(): removes current bait.
  • AddBait(FishingBaitData): assigns bait; when bait was already present, optionally spawns the previous bait prefab in front of the owner before replacing it.

Pass null to AddBait to clear the current bait.

Catch probability methods

  • SetCatchProbabilityData(CatchProbabilityData): replaces custom probability data.
  • AddCustomCatchProbabilityData(CatchProbabilityData): compatibility alias for SetCatchProbabilityData.

Observe fishing state

using FishingGameTool.Fishing;
using UnityEngine;

public sealed class FishingStateExample : MonoBehaviour
{
    [SerializeField] private FishingSystem _fishingSystem;

    private void Update()
    {
        if (_fishingSystem.CanCast)
            Debug.Log("Ready to cast");

        if (_fishingSystem.HasCaughtLoot)
            Debug.Log(_fishingSystem.CaughtLootData._lootName);
    }
}

Validate the FishingSystem reference in project code before reading it.

LootCatchType

Namespace: FishingGameTool.Fishing

  • SpawnItem: instantiates the selected loot prefab and applies throw force when it has a Rigidbody.
  • InvokeEvent: retained for serialized compatibility and currently logs a warning instead of delivering loot.

FishingRod

Namespace: FishingGameTool.Fishing.Rod

FishingRod requires a LineRenderer. Generated rods also contain a SkinnedMeshRenderer, bones, rod-line renderer, attachments, hand grips, and optional reel parts.

Generated rig properties

  • RodRenderer: generated SkinnedMeshRenderer
  • Bones: generated bending bones
  • ReelMount: permanent-line start
  • LineGuides: sorted generated guide transforms
  • LineTip: permanent-line end and usual cast attachment
  • RodLineRenderer: permanent line through the rod guides
  • PrimaryHandGrip: primary IK target
  • SecondaryHandGrip: secondary IK target
  • BendAmount: current normalized bend magnitude

Fishing state properties

  • FishingFloat: active float Transform
  • LineStatus: FishingLineStatus instance
  • HasFishingFloat: true when a float is assigned
  • HasCaughtLoot: current rod catch flag

Bending methods

  • SetBendForce(Vector3 force): converts a world-space force into the rod's local bending plane and sets the target bend.
  • SetBendTarget(Vector3 targetPosition, float force): bends toward a world-space target with a force limited by stiffness and maximum bend angle.
  • ClearBendForce(): returns the target bend to zero.

Generated rig data must be valid for these methods to act.

Fishing integration methods

  • SetFishingSystem(FishingSystem): assigns the owning system used when overload breaks the line.
  • SetFishingFloat(Transform): assigns or clears the active float.
  • LootCaught(bool): updates catch state and automatic bending.
  • RotateReel(float reeledLineLength): rotates generated crank and spool by signed line length.
  • CalculateLineLoad(bool attractInput, float lootWeight, int lootTier): updates load, overload, line breakage, and attraction speed, then returns LineStatus.
  • FinishFishing(): clears transient line load, overload, attraction speed, catch state, and bend target.

SetGeneratedData(...) is public for the editor builder. Normal runtime integrations should use a baked FishingRod prefab instead of calling it manually.

Drive procedural bending manually

using FishingGameTool.Fishing.Rod;
using UnityEngine;

public sealed class RodBendExample : MonoBehaviour
{
    [SerializeField] private FishingRod _rod;
    [SerializeField] private Transform _target;

    private void Update()
        => _rod.SetBendTarget(_target.position, 5f);

    private void OnDisable()
        => _rod.ClearBendForce();
}

FishingLineStatus

Namespace: FishingGameTool.Fishing.Line

FishingLineStatus is a serializable reference type stored by FishingRod.

Configuration fields:

  • _maxLineLoad
  • _overLoadDuration
  • _maxLineLength

Runtime fields:

  • _currentLineLength
  • _currentOverLoad
  • _currentLineLoad
  • _attractFloatSpeed
  • _isLineBroken

The runtime fields are read-only in the default Inspector but remain public for compatibility.

FishingFloat

Namespace: FishingGameTool.Fishing.Float

FishingFloat requires Rigidbody.

Properties:

  • WaterObject: currently detected water GameObject or null
  • IsInWater: true when WaterObject is assigned

Methods:

  • CheckSurface(LayerMask fishingLayer): detects Water, Land, or InAir and updates WaterObject.
  • TryGetLootData(out List<FishingLootData>): safely reads FishingLoot from the detected water object.
  • GetLootDataFromWaterObject(): returns detected loot or null.
  • GetLootDataFormWaterObject(): legacy misspelled compatibility alias.

Prefer TryGetLootData when project code needs to distinguish missing data from an empty list.

SubstrateType

Namespace: FishingGameTool.Fishing.Float

  • Water
  • Land
  • InAir

FishingFloatPathfinder

Namespace: FishingGameTool.Fishing.Float

  • FloatBehavior(FishingLootData, Transform, Vector3, float, float, bool, LayerMask): moves a float along fish or attraction directions while generating obstacle-aware path points.
  • ClearPathData(): clears generated points and smoothed direction before another fishing session.

FishingSystem owns one pathfinder instance. Custom integrations that create their own instance should call ClearPathData between independent sessions.

FishingLoot

Namespace: FishingGameTool.Fishing.Loot

  • _fishingLoot: serialized list of FishingLootData available at the fishing spot
  • GetFishingLoot(): returns the stored mutable list

FishingFloat expects FishingLoot on the same GameObject as the detected water collider.

FishingLootData

Namespace: FishingGameTool.Fishing.LootData

Create through Assets > Create > Fishing Game Tool > New Fishing Loot.

Fields:

  • _lootTier: LootTier
  • _lootType: LootType
  • _weightRange: LootWeightRange
  • _lootRarity: weighted selection value
  • _lootName: display name
  • _lootDescription: display description
  • _lootPrefab: delivered prefab

LootTier

  • Common
  • Uncommon
  • Rare
  • Epic
  • Legendary

LootType

  • Fish: generates autonomous path movement while caught.
  • Item: has no autonomous fish direction.

LootWeightRange

  • _minWeight
  • _maxWeight

FishingSystem safely orders the minimum and maximum values when generating current weight.

FishingBaitData

Namespace: FishingGameTool.Fishing.BaitData

Create through Assets > Create > Fishing Game Tool > New Fishing Bait.

Fields:

  • _baitTier: BaitTier
  • _baitName
  • _baitDescription
  • _baitPrefab

BaitTier contains Uncommon, Rare, Epic, and Legendary. A bait allows loot up to its corresponding LootTier. With no bait, only Common loot is eligible.

CatchProbabilityData

Namespace: FishingGameTool.Fishing.CatchProbability

Create through Assets > Create > Fishing Game Tool > New Catch Probability Data.

Fields:

  • _commonProbability
  • _uncommonProbability
  • _rareProbability
  • _epicProbability
  • _legendaryProbability
  • _minSafeFishingDistanceFactor

The configured value is compared with a random value from 0 to 100. Short casts scale the configured threshold down. Values are not clamped by the data class, so use a sensible range from 0 to 100.

InputHandler

Namespace: FishingGameTool.Example

InputHandler exposes current Input System state without generated wrapper code.

Movement and look:

  • Move: Vector2
  • Look: Vector2
  • JumpPressed: current-frame button press
  • LookUsesPointerDelta: true when the active look device is a Pointer

Fishing:

  • CastPressed
  • CastReleased
  • CastHeld
  • AttractPressed
  • AttractReleased
  • AttractHeld
  • ResetFishingPressed

Interface:

  • MenuPressed
  • InteractPressed

InputHandler enables assigned actions in OnEnable and disables them in OnDisable.

CharacterMovement

Namespace: FishingGameTool.Example

Properties:

  • InputController
  • CameraController
  • Velocity: combined planar and vertical velocity
  • IsGrounded
  • IsOnSteepSlope

Method:

  • GetCurrentCam(): returns CameraController ViewTransform for compatibility with example UI and interaction scripts.

CameraController

Namespace: FishingGameTool.Example

  • ViewTransform: active scene Camera transform

The component owns the included third-person view. Its movement, collision, look-ahead, pitch response, and field-of-view settings are serialized in the Inspector.

InteractionHandler

Namespace: FishingGameTool.Example

  • _interactionEvents: UnityEvent invoked by InteractionSystem
  • InvokeEvents(): invokes the configured UnityEvent

Compatibility aliases

Version 1.5.0.08.26 keeps these aliases to avoid breaking existing integrations:

  • FishingSystem.ForceStopFishing() calls ResetFishing.
  • FishingSystem.FixFishingLine() calls RepairFishingLine.
  • FishingSystem.AddCustomCatchProbabilityData(...) calls SetCatchProbabilityData.
  • FishingFloat.GetLootDataFormWaterObject() calls GetLootDataFromWaterObject.

New code should use the corrected method names.