> For the complete documentation index, see [llms.txt](https://docs.cainos.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cainos.net/interactive-pixel-water/script-reference.md).

# SCRIPT REFERENCE

### Pixel Water

#### Basic Foldout

These settings control the size and interaction layers of the water body.

<table data-header-hidden><thead><tr><th width="179"></th><th></th></tr></thead><tbody><tr><td>Size</td><td><p>A <code>Vector2</code> controlling the width (X) and maximum height (Y) of the water area.</p><p>Modifying this regenerates the mesh.</p></td></tr><tr><td>Fill</td><td><p>A float (0 to 1) representing the vertical fill percentage. </p><p><code>1.0</code> is full height defined by <code>Size.y</code>, while lower values lower the water surface level</p></td></tr><tr><td></td><td></td></tr><tr><td>Interaction Layer Mask</td><td>Defines which layers contain non-trigger colliders that can physically interact with the water (create waves, splashes, etc.).</td></tr><tr><td>Interaction Trigger Layer Mask</td><td>Defines which layers contain trigger colliders that can interact with the water.</td></tr></tbody></table>

#### Rendering Foldout

These parameters control the visual appearance of the water, passed directly to the shader.

<table data-header-hidden><thead><tr><th width="179.5"></th><th></th></tr></thead><tbody><tr><td>Water Color Enabled</td><td><p>Toggles the water color.</p><p>When off the water itself will be transparent</p></td></tr><tr><td>Water Color Shallow</td><td><p>The color gradient from the water surface (shallow) to the bottom (deep).</p><p>The color is blended using alpha blend.</p></td></tr><tr><td>Water Color Deep</td><td><p>The color gradient from the water surface (shallow) to the bottom (deep).</p><p>The color is blended using alpha blend.</p></td></tr><tr><td></td><td></td></tr><tr><td>Underwater Tint Enabled</td><td>Toggles the tint applied to the content behind the water.</td></tr><tr><td>Underwater Tint Shallow</td><td><p>The color tint applied to content behind the water, grading from surface (shallow) to bottom (deep).</p><p>The color is blended using multiply.</p></td></tr><tr><td>Underwater Tint Deep</td><td><p>The color tint applied to content behind the water, grading from surface (shallow) to bottom (deep).</p><p>The color is blended using multiply.</p></td></tr><tr><td></td><td></td></tr><tr><td>Surface Enabled</td><td><p>Toggles the rendering of the surface line at the top of the water.</p><p>The surface line is divided into upper and lower part.</p></td></tr><tr><td>Surface Color Upper</td><td>Color of the upper part of the surface line.</td></tr><tr><td>Surface Color Lower</td><td>Color of the lowerpart of the surface line.</td></tr><tr><td>Surface Thickness Upper</td><td>Controls how thick the upper surface line is rendered.</td></tr><tr><td>Surface Thickness Lower </td><td>Controls how thick the lower surface line is rendered.</td></tr><tr><td>Surface Distortion Mul</td><td>Multiplier for the distortion effect of the surface line.</td></tr><tr><td> </td><td></td></tr><tr><td>Distortion Enabled</td><td>Toggles the refraction/distortion effect of the behind water content.</td></tr><tr><td>Distortion Speed</td><td>Controls the animation speed of the effect.</td></tr><tr><td>Distortion Scale</td><td>Controls the texture scale of the effect.</td></tr><tr><td>Distortion Strength</td><td>Controls the intensity of the effect.</td></tr><tr><td></td><td></td></tr><tr><td>Blur Enabled</td><td>Toggles the blur effect for the behind water content.</td></tr><tr><td>Blur Amount Shallow</td><td>The blur effect intensity, grading from surface (shallow) to bottom (deep).</td></tr><tr><td>Blur Amount Deep</td><td>The blur effect intensity, grading from surface (shallow) to bottom (deep).</td></tr><tr><td></td><td></td></tr><tr><td>Light Shaft Enabled</td><td>Toggles the effect of light beams shining down into the water.</td></tr><tr><td>Light Shaft Color</td><td><p>The color and transparency of the light beams.</p><p>The color is blended using add mode.</p></td></tr><tr><td>Light Shaft Scale</td><td>Controls the size of the light rays.   </td></tr><tr><td>Light Shaft Power</td><td>The power applied to the alpha of the light rays.</td></tr><tr><td>Light Shaft Tilt</td><td>Controls the angle of the light rays.   </td></tr><tr><td>Light Shaft Depth</td><td>Controls the fade-depth of the light rays.   </td></tr><tr><td>Light Shaft Speed</td><td>Controls the animation speed of the light rays. </td></tr><tr><td></td><td></td></tr><tr><td>Wave Enabled</td><td>Toggles the physics-based spring simulation for surface waves.</td></tr><tr><td>Wave Influence Mul</td><td>Multiplier for how much an object's velocity (X and Y) impacts the water surface to create waves.</td></tr><tr><td>Wave Influence Decay Depth</td><td>The depth at which an object no longer creates surface waves (objects deep underwater won't disturb the surface).</td></tr><tr><td>Wave Tension</td><td><p>Controls the stiffness of the wave.</p><p>Higher values make the water surface snap back to rest position faster.</p></td></tr><tr><td>Wave Damping</td><td><p>Controls friction of the wave.</p><p>Higher values make waves settle and stop oscillating faster.</p><p>Avoid setting it to near zero.</p></td></tr><tr><td>Wave Spread</td><td>Controls how fast a wave ripple travels to neighboring vertices.</td></tr><tr><td>Wave Spread Iteration</td><td>The quality/smoothness of the wave propagation calculation (higher is more accurate but more expensive).</td></tr><tr><td>Wave Speed Mul</td><td>Global speed multiplier for the wave physics simulation.</td></tr><tr><td>Wave Velocity Limit</td><td>Clamps the maximum speed of the wave.</td></tr><tr><td>Wave Limit</td><td>Clamps the maximum amplitude of the wave.</td></tr><tr><td></td><td></td></tr><tr><td>Ambient Wave Enabled</td><td>Toggles the constant background waves.</td></tr><tr><td>Ambient Wave Mul</td><td>Global intensity multiplier for the ambient wave.</td></tr><tr><td>Ambient Wave Speed</td><td>Parameters that allow layering up to 4 different wave noises (x, y, z, w) for complex, non-repeating surface wave motion.</td></tr><tr><td>Ambient Wave Frequency</td><td>Parameters that allow layering up to 4 different wave noises (x, y, z, w) for complex, non-repeating surface wave motion.</td></tr><tr><td>Ambient Wave Amplitude</td><td>Parameters that allow layering up to 4 different wave noises (x, y, z, w) for complex, non-repeating surface wave motion.</td></tr></tbody></table>

#### FX Foldout

Controls particle and prefab instantiation when objects interact with the water.

<table data-header-hidden><thead><tr><th width="179.5"></th><th></th></tr></thead><tbody><tr><td>Bubble Enabled</td><td>Toggles bubble effect generation.</td></tr><tr><td>Bubble Duration Mul</td><td>Multiplier for bubble emit duration.</td></tr><tr><td>Bubble Amount Mul</td><td>Multiplier for bubble emit amount.</td></tr><tr><td>Bubble Color Outline</td><td>The outline color of the generated bubble.</td></tr><tr><td>Bubble Color Fill</td><td>The fill color of the generated bubble.</td></tr><tr><td>Bubble Prefab</td><td>The prefab instantiated to create bubbles. (must contain <code>PixelWaterBubble</code> script).</td></tr><tr><td></td><td></td></tr><tr><td>Splash Enabled</td><td>Toggles splash effect generation.</td></tr><tr><td>Splash On Enter</td><td>Whether to generate splash when objects enter the water.</td></tr><tr><td>Splash On Exit</td><td>Whether to generate splash when objects exit the water.</td></tr><tr><td>Splash Color Light</td><td>The color of the lighter part of the splash.</td></tr><tr><td>Splash Color Dark</td><td>The color of the darker part of the splash.</td></tr><tr><td>Splash Color Outline</td><td>The outline color of the splash</td></tr><tr><td>Splash Configs</td><td><p>A list of <code>SplashConfig</code> objects defining different splash types based on object size.</p><p></p><ul><li>Size Range: The object size range (min/max) that triggers this specific splash.   </li><li>Min Speed: Minimum entry velocity required to trigger this splash.   </li><li>Min Depth: Minimum water depth required.   </li><li>Splash Prefab: The visual prefab to spawn.</li></ul></td></tr><tr><td></td><td></td></tr><tr><td>Surface Particle Enabled</td><td><p>Toggles continuous particles on the water surface.</p><p>For example, surface bubble and spark of the lava preset.</p></td></tr><tr><td>Surface Particle Configs</td><td><p>A list of <code>ParticleConfig</code> objects defining particle systems used as the surface particle.</p><p>The script automatically changes their emission shape to match the water surface.</p><p></p><ul><li>Particle System: The particle system to control.</li><li>Emit Mul Per Unit: The emit rate multiplier per unit to ensure if you make the water area larger, the surface particle also emit more particles.</li></ul></td></tr><tr><td></td><td></td></tr><tr><td>In Water Particle Enabled</td><td><p>Toggles continuous particles inside the water volume</p><p>For example, the floating debris in the muddy preset.</p></td></tr><tr><td>In Water Particle Configs</td><td><p>A list of <code>ParticleConfig</code> objects defining particle systems used as the surface particle.</p><p>The script automatically changes their emission shape to match the water surface.</p><ul><li>Particle System: The particle system to control.</li><li>Emit Mul Per Unit: The emit rate multiplier per unit to ensure if you make the water area larger, the surface particle also emit more particles.</li></ul></td></tr></tbody></table>

#### Physics **Foldout**

Controls the custom drag (resistance) applied to objects inside the water.

<table data-header-hidden><thead><tr><th width="230"></th><th></th></tr></thead><tbody><tr><td>Drag Enabled</td><td><p>Toggles the custom drag force.</p><p>Note that we do not use the standard Unity <code>BuoyancyEffector2D</code> drag here, as this custom implementation scale with the velocity, making it more physically correct.</p></td></tr><tr><td> Drag Linear</td><td>How much linear velocity is slowed down.</td></tr><tr><td>Drag Angular</td><td>How much rotation (angular velocity) is slowed down.</td></tr></tbody></table>

#### Event Foldout

This foldout contains some Unity events that you can use to trigger your own function.

<table data-header-hidden><thead><tr><th width="229.5"></th><th></th></tr></thead><tbody><tr><td>On Splash</td><td><p>A Unity Event <code>(int level, Vector3 position)</code> invoked whenever a splash occurs.</p><p>You can hook sound effects or other scripts to this event.</p></td></tr></tbody></table>

### Pixel Water Renderer Feature

<table data-header-hidden><thead><tr><th width="230"></th><th></th></tr></thead><tbody><tr><td>Behind Water Mask</td><td><p>The layer mask of the objects that need to be rendered behind the water.</p><p>You must not include the water itself in this layer mask.</p></td></tr><tr><td>Background Color</td><td>The color to use if there is nothing behind the water.</td></tr><tr><td>Downsample</td><td>Downsample rate for capturing the behind water texture.<br>Higher value improves performance but make behind water content more blury.</td></tr></tbody></table>
