TerrainData.size not working right

GameObject TerrainObj = new GameObject(“Generated Terrain”);
TerrainObj.transform.parent = this.gameObject.transform;
TerrainObj.transform.position = new Vector3 (0f, 0f, 0f);

		TerrainData _TerrainData = new TerrainData();

		_TerrainData.size = new Vector3(12500, 10000, 12500);
		_TerrainData.heightmapResolution = 1025;
		_TerrainData.baseMapResolution = 1024;
		_TerrainData.SetDetailResolution(1024, 16);

I set it to 12500, 10000, 12500 but when I press play the script generates a terrain with 400000,10000,400000 instead. I don’t know why this is happening.

I believe you need to first set your height map resolution before setting the size of your terrain.
Try and set all resolution and then only the terrain size.
Let me know if that works,
thanks and good luck,