🧙♂️Fishing Caster
Handles the logic for casting a fishing line into water — finds valid spots, avoids obstacles, and works with your bobber system. Great for fishing minigames or open-world fishing mechanics.
✅ Requires: A
BobberControllercomponent on the same GameObject.
🔧 Inspector Settings
⚙️ Active
Toggle whether this caster is enabled.
🎯 Player Radius Casting
This section controls where and how the game searches for water in front of the player.
Cast Distance How far forward from the player to start searching. Think: “How far can I cast?”
Search Radius The size of the sphere used to scan for water colliders around the target point.
Height Offset Vertical offset applied to the center of the search sphere. Adjust if your character casts from above or below eye level.
Cast Start Height Where the raycast begins when checking for clear line-of-sight to water. Helps avoid terrain clipping.
🔄 Cast Bias
Adds a slight left/right preference to each cast — useful for simulating natural variation or “favoring” one side.
Left Bias Strength Pulls the cast slightly to the left on even casts.
Right Bias Strength Pulls the cast slightly to the right on odd casts.
Prefer Closer Spots If enabled, picks the nearest valid water spot within range. If disabled, picks randomly (good for variety).
🌊 Water Detection
Tells Unity what counts as water and what blocks your line.
Water Layer Set this to the layer your water surfaces are on (e.g., “Water”). Default is set automatically if empty.
Blocking Layers Layers that block line-of-sight to water (like terrain, rocks, or walls). Usually “Default” or “Terrain”.
👁️ Debug
Enable to see spheres, rays, and hit points drawn in Scene view. Super helpful for tuning distances and avoiding obstructions.
📈 Public Methods
TryCastToWater(out Vector3 waterHitPoint, out GameObject hitWaterObject)
Attempts to find a valid water surface to cast to.
Returns
trueif a spot is found and unobstructed.Sets
waterHitPointto the world position where the bobber should land.Sets
hitWaterObjectto the actual water GameObject hit (useful for effects or sound triggers).
💡 Tip: Call this before triggering your animation or spawning the bobber.
InformWaterHit(Vector3 point)
Tells the attached BobberController where the water was hit. Usually called after TryCastToWater() succeeds.
Last updated