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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Exception when Setting Alphamaps for TerrainData

Discussion in 'Scripting' started by Luuke, Feb 18, 2019.

  1. Luuke

    Luuke

    Joined:
    Jan 18, 2017
    Posts:
    13
    Hey everyone,

    i am currently working on some procedural heightmap generation for the unity terrain system. Now i want to apply Texture layers depending on the height to create biomes. I roughly followed this example:
    https://docs.unity3d.com/ScriptReference/TerrainData.SetAlphamaps.html
    I can blend two Layers together perfectly fine, however when i want to add a third layer I get this exception:
    Error.PNG
    I changed the third float array value accordingly to 3 but it still throws that exception.
    Are there only two Layers allowed or am i missing something else ?
    How can I blend more than two TerrainLayers together via skript ?

    I am using Unity 2018.3 and the Lightweight Render Pipeline.

    Cheers

    Lucas
     
  2. Luuke

    Luuke

    Joined:
    Jan 18, 2017
    Posts:
    13
    Update: When I add a new layer via the Terrain Component it works fine with the script.