API reference
API map
Use the highest-level component that answers the gameplay question. A character normally reads WaterSensor2D or WaterCharacter2D; it should not reproduce the water system’s internal trigger or capture logic.
| Type | Useful methods and data | Use it when |
|---|---|---|
WaterSensor2D |
Refresh(), TryGetCurrent(...), GetSampleAt(...), GetColliderSubmersion01(...), IsPointSubmerged(...); state, depth, surface, CurrentRaw, ripple readings, and water events |
Gameplay needs water state, submersion, raw current, or entry/exit notifications, or a custom controller owns the complete swim model. |
WaterCharacter2D |
RefreshNow(), ApplyWaterMovement(...), GetSwimVelocity(...), CanWaterJump(...), NotifyJumpedFromWater(...), CurrentRaw |
An existing controller needs recommended swimming, diving, surface-following, entry, and water-jump behavior while retaining ownership of current response. |
MotionTracker2D |
SetExternalVelocity(...), LinearVelocity, Speed |
Transform-driven or custom movement must provide reliable velocity for splashes and wakes. |
WaterPhysics |
GetWaterSampleAtWorldPoint(...), GetWaterHeightWorld(...), GetAmbientWaterHeightWorld(...), IsPointInsideWaterVolume(...), IsPointExcluded(...), GetDefaultParams(), SpawnRipple(...) |
A system already targets a known built-in water body and needs a point query or intentional ripple. Prefer a sensor for character state. |
IWaterSurfacePhysics2D |
Shared surface queries and trigger forwarding | Gameplay or custom integrations must support built-in and custom water-surface implementations through one interface. |
DWBuoyancy2D, DWFloatingPlatform2D |
Public tuning fields | A Rigidbody2D object or platform should react to the water automatically. |
WaterRippleOverride |
Override fields and ApplyTo(...) helpers |
One object needs different entry, wake, or exit ripple settings. |
| Current and exclusion types | Current sampling, zone management, and exclusion queries | Runtime code creates, edits, or queries current/exclusion zones. |
| Visual modules | Rain-ripple, debris, floating-prop, and light-ray configuration/actions | Runtime code configures or rebuilds an optional visual module. |
SimpleWater2D, SpriteReflection, preset types |
Shape, reflection, capture, and apply APIs | Runtime/editor tooling controls simple water, reflections, or presets. |
WaterSensor2D exposes both Inspector UnityEvents and C# events: WaterEntered, WaterExited, StateChanged, Surfaced, and FullySubmerged. Their shared WaterSensorEventData includes the previous and new states, surface point, normalized impact and submersion, whether entry happened through the surface, and whether the object left the usable water area. See Water Sensor 2D before choosing an event.
The API tables focus on the methods and values normally needed by gameplay code. The water system manages its generated meshes, capture cameras, registries, shader updates, and trigger components automatically.
Reference index
- WaterPhysics
- WaterSensor2D methods and readings
- WaterCharacter2D methods and readings
- MotionTracker2D API
- IWaterSurfacePhysics2D API
- DWBuoyancy2D API
- DWFloatingPlatform2D API
- WaterRippleOverride API
- Current API
- Exclusion-zone API
- Visual module APIs
- SimpleWater2D and SimpleWaterPreset API
- SpriteReflection API
- Preset scripting API
The reference below groups the public members intended for gameplay, runtime configuration, and tooling. Internal generated renderer, camera, registry, and trigger implementation classes are intentionally not part of the supported user-facing API; the few public hooks used by those systems are separated into the advanced table.
WaterPhysics configuration and status
These fields are the runtime equivalent of the Physics & Simulation Inspector. Changing them updates the values used by subsequent sampling and ripple work; code that changes generated visual structure should use the editor/runtime refresh APIs described for that feature rather than editing generated children directly.
| Members | Type | Purpose |
|---|---|---|
waterInteractionsEnabled |
bool |
Master switch for interaction sampling and ripple generation. |
showRippleGizmos, debugSplashValues |
bool |
Scene/debug visualization controls. |
impactRippleMeshDeformation, impactRippleVisualEffects |
bool |
Select physical surface deformation and/or visual-only impact output. |
baseAmplitude, baseFrequency, baseSpeed, baseDamping |
float |
Default impact-ripple wave parameters. |
impactDiameter, maxRippleRadius |
float |
Default impact footprint and travel limit. |
affectLayers, ignoreOtherTriggers |
Layer mask / bool |
Interaction filtering. |
enableSplash, splashHeightMultiplier, exitRippleSizeMultiplier |
bool/float | Splash-speed boost and exit-size tuning. |
wakeMeshDeformation, wakeVisualEffects, wakeFastCalculation |
bool |
Wake outputs and performance mode. |
maxVisibleRipples, maxVisibleWakeRipples, maxPhysicsSampleRipples |
int |
Visual and physics sampling budgets. |
rippleShaderRefreshRate |
float |
Maximum shader-data refresh frequency. |
wakeAmplitudeMinMax, wakeRippleSize, wakeFrequency, wakeTravelSpeed, wakeDamping |
Vector/float | Wake wave shape and motion. |
rippleSpawnRate, wakeRadiusScaleRange |
float/vector | Wake spawn frequency and speed-to-radius mapping. |
wakeFoamOpacity, wakeFoamWidthScale, wakeFoamTextureSize, wakeFoamFastMode |
float/bool | Wake-foam appearance and performance. |
wakeFoamMaskDebug, wakeFoamMaskDebugColor, wakeFoamMaskDebugSize, wakeFoamMaskDebugFeather, wakeFoamMaskDebugOpacity |
bool/color/float | Wake-mask diagnostics. |
wakeFoamMaskDelay, wakeFoamMaskOffset, wakeFoamMaskDimensions |
float/vector | Wake-mask timing and footprint. |
wakeMinSpeed, wakeMaxSpeed, wakeMinSpacing, wakeForwardOffset, wakeForwardOffsetPerSpeed, wakeDirectionMinSpeed |
float |
Wake eligibility, spacing, placement, and direction thresholds. |
splashMaxEntrySpeed, splashAmplitudeMinMax |
float/vector | Maps entry speed to impact amplitude. This affects ripple/VFX strength; it does not set the character’s entry velocity. |
shallowWaterThreshold, shallowWaterSplashDamping, groundLayer |
float/layer mask | Shallow-water detection and splash attenuation. |
enableManualInteraction, manualAlsoHandlesRigidbodies, manualScanPadding, manualMaxTrackedSpeed, manualRequireMotionTracker |
bool/vector/float | Transform-driven interactor discovery and safeguards. |
Behaviour, WaterInteractionsEnabled, Is2DMode |
Read-only properties | Interface owner, effective interaction state, and water-body mode. |
HasImpactRippleOutput, HasWakeOutput |
Read-only bool |
Whether either physical or visual output is enabled for each ripple family. |
SurfaceCrossRippleSpawned |
Static signal | Global listener signal raised after a surface-crossing ripple spawns. Use AddListener(...) and RemoveListener(...). |
WaterPhysics height and force queries
These methods query a specific built-in water body. Keep a serialized WaterPhysics reference when the caller can affect one of several water bodies. Code that should support both built-in and custom water surfaces can store an IWaterSurfacePhysics2D reference instead; that interface exposes the core height, occupancy, collider, contact, and point-sampling methods.
worldPos is a world-space position. The optional baseLocalY is a local vertical offset from the water root and normally remains 0. Height methods return a world-space Y coordinate. When interactions are disabled or the point is excluded, the height queries return worldPos.y, so check the water state or occupancy when that distinction matters.
| Method | Parameters | Returns | Description |
|---|---|---|---|
GetWaterHeightWorld(...) |
worldPos — world-space sample position; baseLocalY — optional local vertical offset, default 0 |
float — complete surface height in world-space Y |
Includes the calm plane, ambient waves, and interaction-ripple displacement. Use for objects that should follow every visible surface movement. |
GetCalmWaterHeightWorld(...) |
worldPos — world-space sample position; baseLocalY — optional local vertical offset, default 0 |
float — calm surface height in world-space Y |
Excludes both ambient waves and interaction ripples. Use as a stable waterline baseline. |
GetAmbientWaterHeightWorld(...) |
worldPos — world-space sample position; baseLocalY — optional local vertical offset, default 0 |
float — ambient surface height in world-space Y |
Includes ambient waves but excludes impact and wake displacement. |
GetAmbientWaterVerticalVelocityWorld(...) |
worldPos — world-space sample position; sampleDelta — comparison interval; values at or below 0 use Time.fixedDeltaTime |
float — vertical speed in world units per second |
Estimates ambient-wave motion. Returns 0 outside Play mode, when interactions are unavailable, or at an excluded point. |
GetRippleForceWorld3D(...) |
worldPos — world-space sample position |
Vector3 — ripple-only world-space force |
Returns active interaction-ripple force without current contribution. |
GetWaterForceAtWorldPoint(...) |
worldPos — world-space sample position; baseLocalY — optional local vertical offset, default 0 |
Vector3 — combined current and ripple force |
Convenience form of GetWaterSampleAtWorldPoint(...).waterForce. The caller decides how to integrate it into motion. |
GetWaterSampleAtWorldPoint(...) |
worldPos — world-space sample position; baseLocalY — optional local vertical offset, default 0 |
WaterPhysics.WaterSample |
Returns occupancy, submersion, surface height, depth, current, ripple, and combined-force data in one query. |
WaterSample fields
GetWaterSampleAtWorldPoint(...) and WaterSensor2D.GetSampleAt(...) return WaterPhysics.WaterSample.
| Field | Type | Meaning |
|---|---|---|
isInsideWater |
bool |
The point lies inside the water body’s usable interaction volume and is not excluded. |
isSubmerged |
bool |
The point is below the sampled animated surface. Also check isInsideWater when the point must belong to this water body. |
hasCurrent |
bool |
A current module supplied a non-zero current at the point. |
surfaceY |
float |
Complete sampled surface height in world-space Y. |
depth |
float |
surfaceY - worldPos.y; positive below the surface and negative above it. |
normalizedDepth |
float |
Depth divided by the configured water height and clamped from 0 to 1. |
rippleForce |
Vector3 |
Active impact/wake acceleration at the point. |
currentDirection |
Vector3 |
Normalized world-space direction of the sampled current. |
currentStrength |
float |
Falloff-adjusted raw current strength. |
currentInfluence01 |
float |
Normalized zone influence after Entry Falloff, from 0 at an edge to 1 at full influence. |
currentMovementForceDivider |
float |
Falloff-adjusted player-movement divisor supplied by the zone; 1 means no reduction. |
currentForce |
Vector3 |
Legacy-named raw current vector (currentDirection * currentStrength). Exposed as CurrentRaw by the sensor and character helper. |
waterForce |
Vector3 |
Combined raw current and ripple force-like reading. |
WaterPhysics point and collider queries
| Method | Parameters | Returns | Description |
|---|---|---|---|
IsPointInsideWaterVolume(...) |
worldPos — world-space point |
bool |
Tests configured width, underwater height, 2.5D depth, and exclusions. This is a volume test, not merely a below-surface test. |
IsPointExcluded(...) |
worldPoint — world-space point |
bool |
Reports whether an exclusion zone removes water at the point. |
IsExcludedAtWorldPoint(...) |
worldPoint — 2D world-space point |
bool |
Compatibility form of the exclusion query. New world-space code can use IsPointExcluded(...). |
IsPointSubmerged(...) |
worldPoint — world-space point; baseLocalY — optional local vertical offset |
bool |
Tests whether the point is below the animated surface. Combine with IsPointInsideWaterVolume(...) when membership matters. |
IsColliderInWaterDomain(...) |
targetCollider — collider to test |
bool |
Reports whether the collider overlaps the interaction collider and is not excluded. |
IsColliderTouchingWater(...) |
targetCollider — collider to test |
bool |
Public alias of the current collider-domain overlap test. |
IsColliderExcludedFromWater(...) |
targetCollider — collider to test |
bool |
Tests the collider and relevant colliders under the same interaction root against exclusion zones. |
IsColliderExcluded(...) |
other — collider to test |
bool |
Compatibility form used by the exclusion system. Prefer IsColliderExcludedFromWater(...) in gameplay code. |
IsColliderFullySubmerged(...) |
targetCollider — collider to test; z — optional sampling depth |
bool |
Reports whether the collider’s top is below the sampled surface. |
GetColliderSubmersion01(...) |
targetCollider — collider to measure; z — optional sampling depth |
float — normalized range 0–1 |
Estimates the collider’s vertical fraction below the surface; it is not an exact submerged-area calculation. |
TryGetWaterContactState(...) |
touchWaterCollider, swimPoint, fullSubmersionCollider, waterForceSamplePoint, ignoreRippleForces, out state |
bool; writes WaterContactState state |
Builds the low-level combined contact snapshot. Prefer WaterSensor2D for ordinary gameplay. |
WaterContactState contains hasWater, exclusion/contact/submersion flags, sampled surface and depth values, the points used for the query, separate swim and force WaterSample values, and appliedWaterForce. It is primarily the low-level snapshot consumed by WaterSensor2D.
WaterPhysics ripple creation API
| Method | Parameters | Returns | Description |
|---|---|---|---|
GetDefaultParams() |
None | RippleSpawnParams |
Copies this water body’s current impact-ripple defaults for optional per-spawn editing. |
SpawnRipple(...) |
worldPos — world-space center; p — simulation/output settings |
void |
Creates an impact-style ripple and respects interaction/output toggles. |
SpawnImpactRipple(...) |
worldPos — world-space center |
void |
Creates an impact ripple using the water body’s defaults. |
SpawnImpactRipple(...) |
worldPos — world-space center; settings — explicit ripple settings |
void |
Impact-named overload that forwards the supplied settings to SpawnRipple(...). |
SpawnWakeRipple(...) |
worldPos; p |
void |
Creates a wake with the default local surface direction. |
SpawnWakeRipple(...) |
worldPos; wakeDirectionXZ — local surface-plane direction; settings |
void |
Creates a directional wake. The overload with settings before wakeDirectionXZ performs the same operation. |
SpawnRippleDefault(...) |
worldPos; splash — enable configured temporary splash-speed boost |
void |
Compatibility helper for a default impact. Prefer SpawnImpactRipple(...) when boost behavior is unnecessary. |
SpawnRippleDefault(...) |
worldPos; ov — per-object override; wake — create wake instead of impact |
void |
Applies a WaterRippleOverride before spawning. |
SpawnSensorImpactRipple(...) |
worldPos; sourceCollider; optional rippleOverride; verticalSpeed; isExit |
void |
Uses the water’s normal speed mapping to build a sensor-style entry or exit ripple. |
SpawnSensorWakeRipple(...) |
worldPos; wakeDirectionXZ; sourceCollider; optional rippleOverride; speed |
void |
Uses source-object settings and speed mapping to create a directional wake. |
TrySpawnJumpRippleIfAtWaterline(...) |
other — source collider; verticalSpeed |
bool — whether a ripple spawned |
Attempts a filtered waterline-crossing ripple. |
SpawnJumpRippleIfAtWaterline(...) |
other; verticalSpeed |
void |
Compatibility wrapper when the success value is not needed. |
TrySpawnSurfaceCrossRipple(...) |
other; verticalSpeed |
bool — whether a ripple spawned |
Attempts a filtered surface-crossing ripple. |
TrySpawnCharacterSurfaceRipple(...) |
other; verticalSpeed |
bool — whether a ripple spawned |
Character-named compatibility form of the surface-crossing operation. |
TrySpawnJumpExitRipple(...) |
source; verticalSpeed |
bool — whether a ripple spawned |
Attempts a filtered exit ripple. |
SpawnJumpExitRipple(...) |
source; verticalSpeed |
void |
Compatibility wrapper when the exit result is not needed. |
RippleSpawnParams provides amplitude, radius, frequency, speed, damping, rippleSize, and splashScale. overrideOutput allows the per-ripple output flags to replace the water defaults; deformMesh controls physical surface displacement and visualEffects controls visual ripple output.
WaterSensor2D method API
| Method | Parameters | Returns | Description |
|---|---|---|---|
Refresh() |
None | void |
Reacquires or validates the active water, samples state and forces, and dispatches state events. Disable updateAutomatically when your controller owns this call. |
TryGetCurrent(...) |
out direction — normalized world-space current direction; out strength — falloff-adjusted raw current strength |
bool — whether the latest sample contains a current |
Reads the two values used to construct CurrentRaw: direction * strength. The controller decides whether that raw value is a velocity target, acceleration, or another response input. |
SetCurrentWater(...) |
water — surface to assign or null; waterTrigger — optional trigger that established contact |
void |
Assigns a known surface. Automatic trigger/overlap discovery normally handles this association. |
ClearCurrentWater(...) |
water — optional match guard; leftWaterDomain — mark a spatial-domain exit |
void |
Clears readings and emits exit data. When water is supplied, clearing occurs only when it matches the active surface. |
GetSwimPointWorld() |
None | Vector3 — world-space point |
Resolves the configured swim point or its collider-derived fallback. |
GetColliderSubmersion01(...) |
targetCollider — collider to measure |
float — normalized range 0–1 |
Estimates vertical submersion against the sensor’s current water. |
GetSampleAt(...) |
point — transform whose position is sampled |
WaterPhysics.WaterSample |
Returns a complete point sample, or a default sample when the surface or transform is unavailable. |
IsPointSubmerged(...) |
point — transform to test |
bool |
Returns true only when the point is inside the current volume and below the sampled surface. |
The sensor’s direct readings are CurrentWater, CurrentWaterSurface, CurrentWaterTrigger, State, PreviousState, Sample, ContactState, HasWater, IsTouchingWater, IsInsideWater, IsInsideWaterVolume, IsDryByWaterDomain, IsSubmerged, IsPartiallySubmerged, IsSwimmingDepth, IsFullySubmerged, Submersion01, SurfaceY, SurfacePoint, Depth, NormalizedDepth, HasCurrent, CurrentDirection, CurrentStrength, CurrentInfluence01, CurrentMovementForceDivider, CurrentRaw, CurrentForce, RippleForce, WaterForce, Velocity, LastEventData, and SurfaceEntryMinVerticalSpeed. CurrentDirection is normalized; CurrentStrength is the falloff-adjusted scalar setting; CurrentRaw is CurrentDirection * CurrentStrength. CurrentForce is a compatibility alias for CurrentRaw. CurrentMovementForceDivider is the active zone’s falloff-adjusted player-movement divisor and returns to 1 when no current supplies one.
WaterCharacter2D method API
| Method | Parameters | Returns | Description |
|---|---|---|---|
RefreshNow() |
None | void |
Refreshes the attached sensor. Call once at the start of a controller-owned movement step. |
GetRecommendedWaterVelocity(...) |
input — normalized movement input; currentVelocity — base velocity without the controller-owned current offset |
Vector2 — recommended velocity |
Applies shallow-speed and buoyancy recommendations with Time.fixedDeltaTime; it does not run the full swim/dive state machine or apply CurrentRaw. |
GetRecommendedWaterVelocity(...) |
input; currentVelocity; deltaTime — movement-step seconds |
Vector2 — recommended velocity |
Explicit-time-step overload of the recommendation method. |
GetSwimVelocity(...) |
input; currentVelocity |
Vector2 — recommended swim velocity |
Calculates surface/free-swim movement without a dive request using Time.fixedDeltaTime. |
GetSwimVelocity(...) |
input; currentVelocity; dive — request downward free swimming |
Vector2 — recommended swim velocity |
Dive-aware overload using Time.fixedDeltaTime. |
GetSwimVelocity(...) |
input; currentVelocity; dive; deltaTime |
Vector2 — recommended swim velocity |
Full explicit overload for the narrower swim calculation. |
ApplyWaterMovement(...) |
input; currentVelocity — base velocity without the previous current offset; divePressed; maxFallSpeed; deltaTime |
Vector2 — base water velocity |
Runs the complete entry-buoyancy, surface-swim, dive, and buoyancy state machine. It never applies CurrentRaw; the owning controller may divide input by CurrentMovementForceDivider before calling it. |
CanWaterJump(...) |
currentVelocity — velocity before the jump |
bool |
Reports whether state, surface position, lockout, and velocity allow a water jump. |
NotifyJumpedFromWater() |
None | void |
Clears water-locomotion state and begins the surface-follow lockout after the controller applies a jump. |
NotifyJumpedFromWater(...) |
jumpVelocity — retained for controller compatibility |
void |
Compatibility overload; currently performs the same reset. |
NotifyJumpedFromWater(...) |
jumpVelocity; sourceCollider |
void |
Collider-aware compatibility overload; currently performs the same reset. |
GetSurfaceFollowWorldPoint() |
None | Vector3 — world-space point |
Resolves the floating point, sensor swim point, force point, or character transform used for surface following. |
Useful read-only values include Sensor, CurrentWater, CurrentWaterSurface, state and submersion shortcuts, surface/depth readings, CurrentDirection, CurrentStrength, CurrentInfluence01, CurrentMovementForceDivider, CurrentRaw, ripple/water values, ShouldSurfaceSwim, RecommendedSpeedMultiplier, RecommendedGravityMultiplier, and RecommendedBuoyancyAcceleration. CurrentRaw is forwarded unchanged from the sensor and is never integrated by WaterCharacter2D; CurrentForce remains a compatibility alias. CurrentMovementForceDivider forwards the zone’s falloff-adjusted player-movement divisor. RippleVelocity remains a legacy alias for RippleForce.
MotionTracker2D API
| Member | Kind / type | Parameters or value | Description |
|---|---|---|---|
mode |
SampleMode field |
Auto, UpdateDelta, FixedDelta, or RigidbodyVelocity |
Selects how the tracker measures movement. There is no external-velocity enum value. |
smoothing |
bool field |
Enabled/disabled | Smooths sampled velocity. External velocity supplied with SetExternalVelocity(...) is accepted as the authoritative final velocity. |
smoothRate |
float field |
Response rate | Controls how quickly smoothed sampled velocity approaches the new measurement. |
SetExternalVelocity(...) |
Method returning void |
velocity — final world-space Vector2 velocity |
Supplies velocity for the current frame and updates manual interaction tracking. Call it from the loop that owns movement. |
LinearVelocity |
Read-only Vector2 |
Latest measurement | Latest measured or externally supplied world-space velocity. |
Speed |
Read-only float |
Magnitude | Convenience magnitude of LinearVelocity. |
Advanced WaterPhysics integration methods
These members are public because generated renderers, interaction triggers, and water modules use them. They are documented here for completeness, but normal gameplay should use a sensor or the query/ripple APIs above.
| Member | Parameters | Returns | Intended use |
|---|---|---|---|
RefreshExclusionZones() |
None | void |
Rebuilds the owned exclusion-zone cache after runtime code adds or removes zones. |
TrackManualInteractor(...) |
other — collider to track |
bool — whether tracking succeeded |
Registers or refreshes a transform-driven collider. MotionTracker2D normally calls this. |
ApplyRippleDisplacementData(...) |
target — compatible runtime material |
void |
Copies current ripple textures and shader parameters to generated renderers. |
GetConfiguredRippleDisplacementBound() |
None | float — maximum local displacement allowance |
Used for renderer and mesh bounds planning. |
GetActiveRippleEdgeIntervals(...) |
output intervals; xMin; xMax; padding |
int — interval count |
Writes active 2D deformation intervals into the supplied list for runtime mesh patching. |
GetActiveRippleZones(...) |
output zones; X/Z bounds; padding; optional maxZones |
int — zone count |
Writes active 2.5D deformation zones into the supplied list for runtime mesh patching. |
GetRippleHeightLocalForDebug(...) |
localXZ — local surface-plane position |
float — local ripple height |
Shader-matched diagnostic sample. |
OnWaterTriggerEnter/Stay/Exit(...) |
other — interacting collider; triggerTransform — generated trigger |
void |
Forwarded callbacks for generated interaction triggers; not general gameplay notifications. |
Is2DMode |
None | bool property |
Reports whether the owning body uses orthographic 2D mode. |
WaterInteractionsEnabled |
None | bool property |
Combines component activity with the interaction master switch. |
HasImpactRippleOutput, HasWakeOutput |
None | bool properties |
Report whether physical deformation or visual output is enabled for each ripple type. |
WaterSensor2D configuration, events, and readings
| Member | Type | Access | Meaning |
|---|---|---|---|
submersionMode |
WaterSubmersionMode |
Read/write | Chooses ColliderBased, PointBased, or Hybrid classification. |
touchCollider, bodyCollider |
Collider2D |
Read/write | Colliders used for contact and body-percentage/full-submersion tests. |
feetPoint, waistPoint, swimPoint, headPoint |
Transform |
Read/write | Ordered point-based thresholds from shallow contact through full submersion. |
forceSamplePoint |
Transform |
Read/write | Position used for depth, current, and ripple samples. |
shallowSubmersion, halfSubmersion, swimmingSubmersion, fullSubmersion |
float |
Read/write | Collider-mode thresholds in normalized submerged fraction. |
ignoreRippleForces |
bool |
Read/write | Removes ripple contribution from combined WaterForce; RippleForce remains available. |
updateAutomatically, updateInFixedUpdate |
bool |
Read/write | Selects automatic timing. Disable automatic updates when a controller calls Refresh(). |
velocityRigidbody, velocitySampleTransform |
Rigidbody/Transform | Read/write | Sources used to measure entry, exit, wake, and impact velocity. |
onWaterEntered, onWaterExited, onStateChanged, onSurfaced, onFullySubmerged |
WaterSensorEvent |
Read/write UnityEvents | Inspector-configurable event callbacks. |
WaterEntered, WaterExited, StateChanged, Surfaced, FullySubmerged |
event Action<WaterSensorEventData> |
Subscribe/unsubscribe | C# equivalents of the Inspector events. |
| Reading | Type | Meaning |
|---|---|---|
CurrentWater, CurrentWaterSurface, CurrentWaterTrigger |
Water/component references | Active built-in water, shared surface interface, and discovering trigger. |
State, PreviousState |
WaterSubmersionState |
Current and previous classified states. |
HasWater, IsTouchingWater, IsInsideWater, IsInsideWaterVolume, IsDryByWaterDomain |
bool |
Provider, contact, point, usable-volume, and domain-exit status. |
IsSubmerged, IsPartiallySubmerged, IsSwimmingDepth, IsFullySubmerged |
bool |
Convenience state tests. |
Submersion01, Depth, NormalizedDepth, SurfaceY |
float |
Normalized body submersion and sampled surface/depth values. |
SurfacePoint |
Vector3 |
World-space surface point at the force sample X/Z. |
HasCurrent, CurrentDirection, CurrentStrength, CurrentInfluence01, CurrentRaw |
Current readings | Current availability, normalized direction, falloff-adjusted strength, normalized zone influence, and the raw direction-times-strength vector. |
CurrentMovementForceDivider |
float |
Falloff-adjusted divisor for controller-authored movement; always at least 1. |
CurrentForce |
Vector3 |
Compatibility alias for CurrentRaw. |
RippleForce, WaterForce |
Vector3 |
Ripple acceleration and configured combined acceleration. |
Velocity |
Vector2 |
Latest measured character/object velocity. |
Sample, ContactState, LastEventData |
Snapshot structs | Latest raw point sample, combined contact snapshot, and dispatched event payload. |
SurfaceEntryMinVerticalSpeed |
float |
Read-only minimum downward speed used by surface-entry filtering. |
WaterSubmersionMode contains ColliderBased, PointBased, and Hybrid. WaterSubmersionState contains Dry, TouchingWater, ShallowSubmerged, HalfSubmerged, SwimmingDepth, and FullySubmerged.
WaterSensorEventData exposes water, waterBehaviour, previousState, newState, surfacePoint, impact01, submersion01, leftWaterDomain, and enteredThroughSurface.
WaterCharacter2D configuration and readings
| Member | Type | Access | Meaning |
|---|---|---|---|
floatingPoint, floatingDepthOffset |
Transform/float | Read/write | Point followed at the waterline and its desired depth below it. |
surfaceSwimSpeed, diveSwimSpeed |
float |
Read/write | Player-controlled surface and free-swim speeds. |
waterControlResponsiveness |
float |
Read/write | Response used by surface correction, diving, and buoyant return. |
rippleInfluence |
float |
Read/write | Multiplier used when exposing the optional combined WaterForce reading. It does not affect CurrentRaw. |
useWaterEntryBuoyancy, waterEntryPlungeDepth, waterEntryReturnStrength |
bool/float | Read/write | Visible automatic entry-plunge controls. |
surfaceSwimmingStartsAt, shallowSpeedMultiplier, swimSpeedMultiplier |
state/float | Read/write | State and speed multipliers used before/full swimming; some are hidden compatibility/tuning fields. |
waterGravityMultiplier, swimGravityMultiplier, buoyancyAcceleration |
float |
Read/write | Low-level recommendations used by custom integration methods. |
movementIgnoresRippleForce |
bool |
Read/write | Uses the ambient waterline rather than ripple-displaced height for movement calculations. |
surfaceSettleDistance, diveStartDownSpeed, diveStartDepth, diveSurfaceExitDistance, minDiveTime |
float |
Read/write | Advanced surface/dive thresholds. |
waterJumpSurfaceLockout |
float |
Read/write | Delay before surface following can reactivate after a jump. |
waterEntryMinDownSpeed, waterEntryMinPlungeDepth, waterEntryMinTime, waterEntrySurfaceReleaseDistance, waterEntryStallRecoveryTime, waterEntryMaxDepthSpeed, waterEntryDrag, waterEntryMaxRiseSpeed |
float |
Read/write | Advanced/compatibility entry tuning fields. |
| Reading | Type | Meaning |
|---|---|---|
Sensor, CurrentWater, CurrentWaterSurface |
References | Attached sensor and its active surface. |
State, PreviousState, CurrentLocomotion |
Enums | Sensor state and current water-locomotion branch. |
HasWater, IsInWater, IsTouchingWater, IsSubmerged, IsFullySubmerged, IsSwimmingDepth, ShouldSurfaceSwim |
bool |
Convenience water and locomotion tests. |
Submersion01, Depth, NormalizedDepth, SurfaceY, SurfacePoint |
Number/point | Forwarded surface and depth readings. |
CurrentDirection, CurrentStrength, CurrentInfluence01, CurrentRaw |
Current readings | Forwarded normalized direction, falloff-adjusted strength, normalized zone influence, and unchanged raw vector. |
CurrentMovementForceDivider |
float |
Forwarded falloff-adjusted divisor for controller-authored movement. |
CurrentForce |
Vector2 |
Compatibility alias for CurrentRaw. |
RippleForce, WaterForce |
Vector2 |
Ripple reading and optional raw-current/ripple combined reading. Neither is integrated by WaterCharacter2D. |
RippleVelocity |
Vector2 |
Legacy alias of RippleForce; despite its name it is acceleration. |
RecommendedSpeedMultiplier, RecommendedGravityMultiplier, RecommendedBuoyancyAcceleration |
float |
Low-level recommendations for a custom controller. |
WaterCharacterLocomotionState contains None, WaterEntryBuoyancy, SurfaceSwimming, and Diving.
IWaterSurfacePhysics2D API
Use this interface when gameplay code should support the built-in WaterPhysics surface and custom implementations.
| Member | Returns | Purpose |
|---|---|---|
Behaviour, WaterInteractionsEnabled |
MonoBehaviour, bool |
Owning component and current interaction availability. |
GetWaterHeightWorld, GetCalmWaterHeightWorld, GetAmbientWaterHeightWorld |
float |
Complete, calm, and ambient-only surface heights. |
GetRippleForceWorld3D |
Vector3 |
Ripple-only acceleration. |
IsPointInsideWaterVolume, IsPointExcluded, IsPointSubmerged |
bool |
Point-domain/exclusion/submersion queries. |
IsColliderInWaterDomain, IsColliderExcludedFromWater, IsColliderTouchingWater, IsColliderFullySubmerged |
bool |
Collider queries. |
GetColliderSubmersion01 |
float |
Normalized vertical submersion estimate. |
TryGetWaterContactState |
bool + out WaterContactState |
Combined low-level sensor snapshot. |
GetWaterSampleAtWorldPoint |
WaterSample |
Point sample containing surface, depth, current, and ripple data. |
OnWaterTriggerEnter, OnWaterTriggerStay, OnWaterTriggerExit |
void |
Trigger forwarding required by custom surface implementations. |
DWBuoyancy2D API
DWBuoyancy2D has no public movement methods; configure its public fields and let its physics loop apply forces to the required Rigidbody2D.
| Field | Type | Meaning |
|---|---|---|
pointSpacing, maxFloatPoints |
float/int | Generated float-point density and maximum count. |
buoyancyStrength, maxDepth |
float |
Lift strength and depth at which maximum lift is reached. |
flowStrength, currentStrength |
float |
Ripple/ambient flow and current response. |
applyCurrentToWholeBody, currentAffectsOnlyX |
bool |
Whole-body averaging and horizontal-only current options. |
waterLinearDrag, waterAngularDrag |
float |
Damping applied while submerged. |
useStoredAirDefaults |
bool |
Restores serialized rather than runtime-captured air damping. |
showDebugLines, debugLineScale |
bool/float | Scene diagnostics. |
DWFloatingPlatform2D API
DWFloatingPlatform2D also operates automatically; its supported public surface is configuration data.
| Fields | Meaning |
|---|---|
platformCollider, floatPoint |
Platform collider and optional surface-sampling point. |
fixedPosition, submersionDepth, verticalSmoothTime, maxVerticalSpeed |
Horizontal anchoring and vertical follow behavior. |
riderDipDepth, riderDipSmoothTime |
Rider-induced settling. |
rippleResponse, rippleSmoothTime |
Ripple contribution and filtering. |
enableTilt, maxTiltAngle, waterTiltStrength, riderTiltStrength, tiltSmoothTime |
Water/rider tilt behavior. |
riderLayers, riderCheckHeight, riderCheckInset |
Rider-detection filter and box dimensions. |
showDebug, debugSurfaceColor, debugRiderBoxColor |
Scene diagnostics. |
WaterRippleOverride API
| Members | Meaning |
|---|---|
overrideSplashMaxAmplitude, splashMaxAmplitude, overrideSplashRadius, splashRadius |
Entry ripple override switches and values. |
overrideWakeMaxAmplitude, wakeMaxAmplitude, overrideWakeRadius, wakeRadius |
Wake overrides. |
useExitOverrides, overrideExitMaxAmplitude, exitMaxAmplitude, overrideExitRadius, exitRadius |
Optional exit-specific overrides. |
overrideSplashBlob, splashBlobEnabled, splashBlobScale, overrideSplashBlobExitDamping, splashBlobExitDamping |
Central splash visual overrides. |
| Method | Parameters | Returns | Purpose |
|---|---|---|---|
ApplyTo(...) |
ref RippleSpawnParams p, bool wake |
void |
Applies enabled splash/wake overrides. |
ApplySplashBlobOverride(...) |
ref p, isExit |
void |
Applies central-blob scale/disable/exit damping. |
TryGetSplashOverrides(...), TryGetWakeOverrides(...), TryGetExitOverrides(...) |
out maxAmplitude, out radius |
bool |
Reads enabled overrides; exit falls back to splash when configured. |
Current API
WaterCurrentAffectable is a marker component with no public members. It opts a non-Rigidbody object into marked-object automatic current movement.
| WaterCurrentModule member | Type/return | Purpose |
|---|---|---|
globalCurrentEnabled, wholeWaterLocalDirection, wholeWaterStrength |
Configuration | Whole-water current. |
autoAffectMode, affectLayers, ignoreTags, ignoreTriggerColliders |
Configuration | Automatic target selection and filtering. |
rigidbody3DForceMode, rigidbody3DMultiplier, rigidbody2DMultiplier, nonRigidbodyMoveMultiplier |
Configuration | Application mode/scales per target type. |
useColliderBoundsCenterFor3D, useColliderBoundsCenterFor2D |
bool |
Sample at collider center rather than transform origin. |
TryGetCurrentSampleAtWorldPoint(...) |
bool + out WaterCurrentSample |
Returns the highest-priority/falloff-adjusted current sample. |
TryGetCurrentAtWorldPoint(...) |
bool + out Vector3 |
Returns current vector when present. |
GetCurrentAtWorldPoint(...) |
Vector3 |
Current vector or zero. |
IsPointInsideWholeWater(...) |
bool |
Tests the global current domain. |
GetCurrentZonesRoot(...), GetCurrentZones(...), GetCurrentZoneList() |
Transform/collections | Zone access. |
CreateCurrentZone(), DeleteCurrentZone(...), DeleteAllCurrentZones(), PruneEmptyCurrentZonesRoot() |
Mutation methods | Runtime/editor zone management. |
WaterCurrentSample contains hasCurrent, normalized direction, scalar force, influence01, contributing zone, and the ForceVector convenience property.
| WaterCurrentZone member | Meaning |
|---|---|
zoneEnabled, zoneMode, zoneSize, volumeDepth, surfaceTolerance |
Zone activation, 2D/2.5D shape, and surface band. |
localDirection, strength, edgeFalloff, priority |
Current direction, acceleration, boundary fade, and overlap priority. |
showGizmo, showDirectionArrow, showCurrentLines and currentLine* fields |
Scene/runtime line visualization and sorting. |
TryGetCurrentSampleAtWorldPoint(...), TryGetCurrentAtWorldPoint(...), GetCurrentAtWorldPoint(...) |
Sample APIs. |
ContainsWorldPoint(...), GetDirectionWorld() |
Shape test and normalized world direction. |
GetModeLabel(...) |
Static display label for a ZoneMode. |
RefreshCurrentLinesVisual() |
Rebuilds the current-line presentation. |
Exclusion-zone API
| WaterExclusionModule method | Returns | Purpose |
|---|---|---|
GetExclusionZones(...), GetExclusionZoneList() |
Array/read-only list | Reads owned zones. |
CreateExclusionZone() |
WaterExclusionZone2D |
Creates and owns a zone. |
DeleteExclusionZone(...), DeleteAllExclusionZones() |
void |
Removes one/all owned zones. |
GetExclusionZonesRoot(...), PruneEmptyExclusionZonesRoot() |
Transform/void | Manages the generated zone container. |
WaterExclusionZone2D exposes shapeType, tint, autoRefresh, and showShapeGizmo; owner/sorting/shape properties (OwnerWaterSystem, SortingLayerName, SortingOrder, ShapeOffset, BoxSize, OvalSize, OvalSegments, ContourFadeWidth, ContourMiterLimit); and read-only ShapeValidationMessage, PolygonPoints, PolygonCollider, and MeshRenderer.
Its public methods are ContainsWorldPoint(...), ShouldExcludeWorldPoint(...), GetLocalShapePoints(), AdoptOwnerSortingDefaults(), FindOwnerUnderwaterRenderer(), RefreshAll(), EnsureMinimumPolygonPoints(), InsertPolygonPoint(...), and RemovePolygonPoint(...).
Visual module APIs
| Type | Public configuration/data | Public methods |
|---|---|---|
WaterRainRipples |
zoneShape, rectSize, circleRadius, zoneOffset, ripplesPerSecond; min/max amplitude, frequency, speed, damping, radius; deformMesh, visualEffects, spawnImpactFoam |
No public action methods; Play mode spawning is automatic while the module is enabled. |
WaterDebrisParticles |
zones: List<DebrisZone>; each zone exposes name/enabled, spawn shape/size/offset/radius, surface-follow/peak settings, count/scale/material/texture/color/opacity, sorting, rotation, wiggle, flow, and friction |
EnsureZoneList(), AddZone(), PrepareForPresetLoad(), RefreshZones(), ClampSpawnZoneToWaterBounds(), RespawnDebris(), RespawnZone(index) |
WaterFloatingProps |
props: List<FloatingProp> plus surface sorting fields; each prop exposes identity, texture, placement/size/rotation/color, follow/peak/drift/wiggle/rotation/tilt/deformation/clearance settings |
AddProp(texture), NormalizeAutomaticPropNames(), DeleteGeneratedObjects(), ClampAllPropsToWater(), ClampPositionToWater(...), MaxRadiusAtPosition(...) |
WaterLightRays |
layers: List<LightRayLayer> plus placement, shape, animation, appearance, and sorting fields. LightRayLayer exposes the same per-layer categories. Enums: BlendMode, RayAngleMode. |
EnsureLayerList(), AddLayer(), DuplicateLayer(index), DeleteLayer(index), DeleteGeneratedObjects(), RefreshRippleMaskData() |
Every module also inherits moduleEnabled and the read-only editor metadata ModuleTitle, ModuleIconName, and ModuleColor from WaterModule.
SimpleWater2D and SimpleWaterPreset API
| SimpleWater2D member | Type/return | Purpose |
|---|---|---|
WaterMaterial, SortingLayerName, SortingOrder, CurveResolution, HorizontalResolution, Preset |
Read/write properties | Runtime material, sorting, shape quality, and assigned preset. |
ShapeValidationMessage, PointCount |
Read-only | Current shape validation and point count. |
GetPoint(index) |
BezierPoint |
Returns one shape point. |
IsPointPositionAvailable(...) |
bool |
Checks whether a point can occupy a position. |
SetPoint(...), ResetPointTangents(...) |
void |
Edits one point/tangents. |
ResetRectangle(...), AddPoint(), InsertPoint(...), RemoveLastPoint(), RemovePoint(...) |
void |
Shape editing. |
RebuildMesh() |
void |
Rebuilds generated geometry after edits. |
RefreshReflectionCapture(), RefreshReflectionMaterialState() |
void |
Refreshes reflection resources/state. |
CaptureToPreset(...), ApplyPreset(...) |
void |
Transfers settings to/from a SimpleWaterPreset. |
ApplyEditorCreationDefaultsFromPreset() |
bool |
Applies creation defaults when available. |
ConfigureDefaultMaterial(material) |
static void |
Applies the component’s default shader values to a compatible material. |
SimpleWater2D.BezierPoint contains position, inTangent, and outTangent. WaveSettings contains amplitude, frequency, speed, and affectedAmount.
SimpleWaterPreset exposes readOnly, sorting/quality/wave/reflection fields, points, and material. Its methods are CaptureFrom(water), ApplyTo(water, assignThisPreset), and ClearToBlank().
SpriteReflection API
| Member | Type | Purpose |
|---|---|---|
includeChildren, copySpriteMaterial, reflectionOffset, overrideWaterline, waterlineOffset, showWaterlineGizmo |
Read/write properties | Renderer collection, proxy material, axis correction, optional world-space waterline, and Scene gizmo. |
TryGetWaterlineBounds(out bounds) |
bool |
Gets the bounds used to initialize/visualize the marker waterline. |
EnsureWaterlineWorldYInitialized(source = null) |
void |
Converts the serialized offset to a world-space waterline once, using renderer bounds. |
Preset scripting API
WaterSystemPreset is the full main-water preset asset. Its public data contains readOnly, controller/material state blocks, module states, current-zone states, and exclusion-zone states.
| Method | Purpose |
|---|---|
CaptureFromWater(system) |
Captures the selected main water configuration into the preset. |
ApplyToWater(...) |
Applies captured controller, material, module, and zone state according to its arguments. |
ClearToBlank() |
Removes captured state and returns the asset to an empty preset. |
The preset’s state classes only store saved settings. Usually, create and apply presets from the Inspector. If you need to control presets from code, call CaptureFromWater or ApplyToWater on WaterSystemPreset instead of changing its internal state fields yourself.
