Add detail meshes at runtime

Hi,

I’m generating terrains at runtime, and now I’m trying to add detail meshes, though they don’t show up.
I use the following settings for the DetailPrototype:

prototype = myRockPrefab (it has mesh, and material and everything)		
prototypeTexture = null
minWidth = .1
maxWidth = 10
minHeight = .1
maxHeight = 10
noiseSpread = .1
bendFactor = 0
healthyColor = Yellos-ish
dryColor = Brown-ish
renderMode = VertexLit

I add this to my terrainData’s ‘detailPrototypes’, and then make a densityLayer witch I set on 10 everywhere, and set the detailLayer. I do the exact same for my grass (except the grass doesn’t have a prototype(mesh) and does have a prototypeTexture).
The rocks don’t show, the grass does show.

I then make a terrain from this terrainData ( Terrain.CreateTerrainGameObject(terrData); ).
I also tried to ‘Flush’ this terrain again, but doesn’t change anything :frowning:

Grass but no rocks

(If you are wondering how I got the DetailPrototype to show up in the inspector: I build a class mimicing the DetailPrototype, and then convert it when setting it.)

Hopefully someone here can help me,

Thanks!

-Pablo

Hello,
I know this is an old post, but some people might need this.
There is a simple not documented boolean which allows to enable the mesh instead of the texture2D.

DetailPrototype detailPrototype = new DetailPrototype();
detailPrototype.prototype = myPrototype;
detailPrototype.usePrototypeMesh = true;

Hope it will help :slight_smile: