Terrain Details below ground

I have a problem with my dynamically generated Terrain.
I want to add details (grass) which I basically do this way:

DetailPrototype detailGrassProto = new DetailPrototype();
detailGrassProto.prototype = Resources.Load("prefabs/AlienGrass") as GameObject;
detailGrassProto.usePrototypeMesh = true;
detailGrassProto.renderMode = DetailRenderMode.Grass;
terrainPrototypes[0] = detailGrassProto;
terrainData.detailPrototypes = terrainPrototypes;
for (var y = 0; y < terrainData.detailHeight; y++) {
 for (var x = 0; x < terrainData.detailWidth; x++) {
  float height = terrainData.GetHeight(y, x);
  if (height > terrainSize.y / 2) {
   map[x, y] = 1;
  } else {
   map[x, y] = 0; 

The problem is, the grass seems to be generated at the height of 0. So I always see only half of it through the terrain.
Has anyone an idea how to solve this?


Ah, I found the solution.
So for everyone who might have the same problem.
The mistake is to think of the grass as an object that is placed there.
So instantiating it like

detailGrassProto.prototype = 

is wrong and leads to objects on your terrain. Instead you have to add a texture to the prototype like this:

detailGrassProto.prototypeTexture =
(Texture2D)Resources.Load(TEXTURE_GRASS, typeof(Texture2D));