Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

Discussion in '2022.2 Beta' started by sstrong, Oct 17, 2022.

  1. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,205
    This worked fine in 2022.1. Has something changed in the latest beta?
     
  2. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,205
    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.
     
  3. DavidHoogenbosch

    DavidHoogenbosch

    Joined:
    Aug 28, 2020
    Posts:
    1
    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:

    Code (CSharp):
    1.   _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.
     
    LeonhardP and StaggartCreations like this.
  4. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,205
    I'll check it out. Thanks