BUG? Has TerrainData.SetDetailLayer(..) changed in 2022.2?

This worked fine in 2022.1. Has something changed in the latest beta?

Detail (aka grass) doesn't render with Built-in Render Pipeline when setting detail prototype and SetDetailLayer in code (the default terrain tools work fine in the editor).

DetailPrototype.Validate(out string msg) returns True with no error message.

Do we now need to set new properties for 2022.2 or is it a bug? Documentation is very sparse.

Ran in to this after upgrading from unity 2019 LTS to 2022.2.

In the changes from 2022.1 to 2022.2 I found this:

Terrain: Improved terrain details scattering algorithm to allow more consistent coverage. Legacy distribution is still available in the quality settings.

That means the new option DetailScatterMode changed the meaning of the values I set the detail layer. It was set to CoverageMode where my code assumed InstanceCountMode.The latter was the only mode available in 2019 LTS.

Fixed for now by adding this:

  _terrain.terrainData.SetDetailScatterMode(DetailScatterMode.InstanceCountMode);

But the coverage mode does look more intuitive to program against so I'll probably switch over at some point.

2 Likes

[quote=“DavidHoogenbosch”, post:3, topic: 897450]
Ran in to this after upgrading from unity 2019 LTS to 2022.2.

In the changes from 2022.1 to 2022.2 I found this:

Terrain: Improved terrain details scattering algorithm to allow more consistent coverage. Legacy distribution is still available in the quality settings.

That means the new option DetailScatterMode changed the meaning of the values I set the detail layer. It was set to CoverageMode where my code assumed InstanceCountMode.The latter was the only mode available in 2019 LTS.

Fixed for now by adding this:

  _terrain.terrainData.SetDetailScatterMode(DetailScatterMode.InstanceCountMode);

But the coverage mode does look more intuitive to program against so I’ll probably switch over at some point.
[/quote]
I’ll check it out. Thanks