Quick answer: Set the Texture 2D Array’s Wrap Mode to Repeat in its importer. Or use a Fraction node on the UV before the sample to wrap explicitly. Pass the right Slice index for the layer you want.
Terrain shader uses a Texture 2D Array for layers. UV tiles past 1.0 stretch out across the edge. Wrap Mode is set to Clamp on the asset.
The Symptom
Sample Texture 2D Array shows the texture clamped at edges instead of repeating. Or returns wrong layer when the slice index goes out of range.
The Fix
Wrap Mode on the asset. Select the Texture2DArray asset. Inspector → Wrap Mode → Repeat. Apply.
Or frac() in the graph.
UV (Tiling) -> Fraction -> Sample Texture 2D Array.UV
Slice -> Sample Texture 2D Array.Index
Fraction wraps UVs into [0,1] regardless of input. Robust against clamped textures.
Slice index. Pass an int between 0 and (array length - 1). Use a Custom Function or a Property to feed the slice from script.
Per-Vertex Slice
For terrain, encode slice index in a vertex color channel. Sample once per fragment using the interpolated slice. With a few slices and barycentric blending, you get smooth per-tile blends.
Verifying
Apply the shader to a quad. Tile UV by 4 (UV * 4). With Repeat or Fraction, the texture tiles 4x. With Clamp and no Fraction, the texture stretches once.
“Repeat the texture, or frac the UV. Right slice index. Tiles render.”
Related Issues
For Shader Graph Time frozen, see Time node. For SRP Batcher, see SRP Batcher.
Repeat or fraction. Right slice. Tile.