Getting Started With The Water System

Creating A Water Object

We create a water object from the Hierarchy's Create menu:

2D Object → Game2D Water Kit → Water Object

Create 2D Water Object from the Hierarchy's Create menu

Resizing The Water Object

We resize the water object right in the scene view using the Rect Tool, or we can just provide the width and the height in the water component inspector.

Resize Water Object in the component inspector

Script Reference

1
waterObject.MainModule.SetSize(new Vector2(width, height));

Sorting The Water Object Relative To Sprites

Before trying to sort the water object relative to sprites, we first need to make sure that the Rendering Queue property, under Rendering Options in the water material inspector, is set to Transparent.

Note

The Rendering Queue property is set to Transparent by default.

Water Material Rendering Options

Then, under the Rendering Properties in the water component inspector, we specify the sorting layer as well as the order within that layer.

Water Component Rendering Options

Script Reference

1
2
waterObject.RenderingModule.SortingLayerID = SortingLayer.NameToID("Default");
waterObject.RenderingModule.SortingOrder = 0;

Info

We will look into the other rendering properties later in this guide.