- Home /
How to create a detail (Grass) prototype
Hello everyone, I'm new to Unity but I want to try to generate a Landscape from the script. For that reason I wanted to instantiate grass details. When looking at forums and tutorials I always see that they just instantiate a "DetailPrototype". But I don't know how this object has to look like.
Is that a prefab from the Editor which I just load (somehow)?
Or is that completely created by code like new DetailPrototype(GrassTexture, Size,...)
I'm a bit lost here. Hopefully someone might help me with that.
Furthermore, how can I (in general) apply a Detail to my terrainData? I understand, that I need to use the GetDetailLayer() to get my Layers-Array. So I write terrainData.GetDetailLayer(0, 0, terrainData.detailWidth, terrainData.detailHeight, 0); which gives me back an 2D int[,] array. I understand it so far that I have to enter the integer value for a certain detail here (e.g. 0 = stone, 1 = grass...) but how do I link the number to the prototype I want to instantiate?
terrainData.detailPrototypes.Length returns 0 so it looks like I did something wrong.
Thank you very much, Tobias
Your answer
![](https://koobas.hobune.stream/wayback/20220613120422im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How Do I Fix My Grass? 2 Answers
Terrain Grass Detail Texture Atlas 0 Answers
Custom Terrain Details Shader,Custom Detail Shader In 2019.2 2 Answers