How change appearance of the texture on the terrain?

Hello,

I want to change texture in certain place on the terrain after the start of my game and I almost did it, however I dosesn’t look like the orginal one and I don’t really know how to change it. On the picture the left sand texture is generated by the code and the right one is the orginal one which I can add using editor.

53327-3.png

I also attach the texture’s inspector. Maybe it would be helpfull.

And the code which generate the sand texture on the terrain:

using UnityEngine;
using System.Collections;

public class malowanieTektur : MonoBehaviour {

void Awake () {
	TerrainData terrainData = Terrain.activeTerrain.terrainData;
	float[, ,] splatmapData = new float[terrainData.alphamapWidth, terrainData.alphamapHeight, terrainData.alphamapLayers];

	float[, ,]  splatmapDataCurent =terrainData.GetAlphamaps(0, 0, terrainData.alphamapWidth, terrainData.alphamapHeight);
	splatmapData = splatmapDataCurent;

	Vector3 splat = new Vector3(0,1,0);
	splat.Normalize ();

	for (int j=0; j<100; j++){ 
		for (int i=0; i<100; i++) {
			splatmapData [i, j, 1] = splat.x;
			splatmapData [i, j, 1] = splat.y;
	}
	}

	terrainData.SetAlphamaps(0, 0, splatmapData);   

}

}

Study this

Thank @tanoshimi