Terrain.SetNeighbors causes black lines [Unityscript]

I am using Terrain.SetNeighbors in my code to connect different chunks I am creating using a perlin function of mine. However, whenever I use Terrain.SetNeighbors, I get black shadows in between all of the Terrains. Isn’t this meant to stop this?

Here is my code:

function AddChunksToNeighbor()
	var Up : Terrain;
	var Down : Terrain;
	var Left : Terrain;
	var Right : Terrain;
	if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x, ChunkOrigin.y + 1)))
		Up = StandardVars.Chunks[Vector2(ChunkOrigin.x, ChunkOrigin.y + 1)].ChunkObject.GetComponentInChildren(Terrain);
	if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x, ChunkOrigin.y - 1)))
		Down = StandardVars.Chunks[Vector2(ChunkOrigin.x, ChunkOrigin.y - 1)].ChunkObject.GetComponentInChildren(Terrain);
	if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x - 1, ChunkOrigin.y)))
		Left = StandardVars.Chunks[Vector2(ChunkOrigin.x - 1, ChunkOrigin.y)].ChunkObject.GetComponentInChildren(Terrain);
	if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x + 1, ChunkOrigin.y)))
		Right = StandardVars.Chunks[Vector2(ChunkOrigin.x + 1, ChunkOrigin.y)].ChunkObject.GetComponentInChildren(Terrain);
	terrain.SetNeighbors(Up, Down, Left, Right);

Here is what my terrain looks like without:

And here is what it looks with the terrain.SetNeighbors(Up, Down, Left, Right); line:

I know that all of the code should work, and that the Left, Right, Up, Down variables are the X-, X+. Z- and Z+ terrains.

Any help is greatly appreciated, cheers.

Took me quite a while to find it out… Actually, I just wanted to submit a bug report, but could not reproduce it directly. However, after a while I have found out that all terrains must be on the same y position! Probably that is not a Unity bug, but simply a constraint.

I’m running into this same issue (now 2 years later) with Unity 5.6.1f1

I’ve used the SetNeighbors function before and it’s worked fine, however it’s now giving me black lines on all the edges… and all my Terrains are at Y0 and are set to the same scale. So, I’m with FreebordMAD on this one… I’m not sure if this is a bug or what, but it’s really annoying.

(Update) OK, so I’m a putz… it’s fixed and I’m hoping my solution will work for others. When I was building the tiled terrains, I’ve been working across, then down… however, when I built the setneighbors function, I worked down, then across… so, the script worked fine but the neighbors were all whonky. So, make sure you assign the neighbors with the correct pattern and based on the correct X & Z coordinates.

Left, Top, Right, Bottom, which correlates to -X, -Z, +X ,+Z