I'm currently attempting to set a grid of neighboring terrain's LOD to match, and having serious troubles. I don't usually ask for help, but here goes. When I run the following code, Unity completely crashes with an Access Violation (0xc0000005): Code (csharp): // set neighbours, find for painting //setup raycast values for (int a = 0; a < 5; a++) { Terrain[] terrainNeighbours = new Terrain[5]; RaycastHit[] neighbourRays = new RaycastHit[5]; float xShift = 250; float zShift = 250; //shift loop position if(a == 0) { zShift = -250; } if(a == 1) { xShift = 750; } if(a == 2) { zShift = 750; } if(a == 3) { xShift = -250; } Vector3 neighbourBasePosition = new Vector3(modifiedTerrain.transform.position.x + xShift,modifiedTerrain.transform.position.y,modifiedTerrain.transform.position.z + zShift); //setup raycast values int layerMaskPrimary = 1 << 8; int layerMaskSecondary = 1 << 9; int layerMask = layerMaskPrimary | layerMaskSecondary; Physics.Raycast(new Vector3(neighbourBasePosition.x,50000,neighbourBasePosition.z), Vector3.down, out neighbourRays[4], 100000, layerMask); Physics.Raycast(new Vector3(neighbourBasePosition.x - 500,50000,neighbourBasePosition.z), Vector3.down, out neighbourRays[0], 100000, layerMask); Physics.Raycast(new Vector3(neighbourBasePosition.x,50000,neighbourBasePosition.z + 500), Vector3.down, out neighbourRays[1], 100000, layerMask); Physics.Raycast(new Vector3(neighbourBasePosition.x + 500,50000,neighbourBasePosition.z), Vector3.down, out neighbourRays[2], 100000, layerMask); Physics.Raycast(new Vector3(neighbourBasePosition.x,50000,neighbourBasePosition.z - 500), Vector3.down, out neighbourRays[3], 100000, layerMask); for(int n = 0; n < neighbourRays.Length; n++) { if(neighbourRays[n].collider) { terrainNeighbours[n] = neighbourRays[n].collider.gameObject.GetComponent<Terrain>(); } } //set terrain array if(terrainNeighbours[4] != null) { terrainNeighbours[4].SetNeighbors(terrainNeighbours[0],terrainNeighbours[1],terrainNeighbours[2],terrainNeighbours[3]); // set neighbours terrainNeighbours[4].basemapDistance = 1500; terrainNeighbours[4].Flush(); terrainNeighbours[4].heightmapPixelError = 0.0f; } } I can get it to avoid crashing by adding the line: Code (csharp): terrainNeighbours[n].SetNeighbors(null,null,null,null); // set neighbours In the collider for loop, but obviously this is counterintuitive as it basically resets the neighboring I'm trying to achieve. Any help would be much appreciated.