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. Dismiss Notice

Terrain: trees hidden while painting texture

Discussion in 'World Building' started by dts0301, Feb 14, 2021.

  1. dts0301

    dts0301

    Joined:
    Feb 12, 2016
    Posts:
    7
    Hi, I have an issue where while I am holding down the click to paint my terrain with a layer all the trees are hidden and when I release, they reappear. What's causing this and how can I make it not do this?
     
  2. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    That's by design, terrain painting would otherwise slow down to a crawl.
     
  3. JemWritesCode

    JemWritesCode

    Joined:
    Dec 13, 2021
    Posts:
    1
    Is there a way to turn it off though? The flashing of the trees in and out makes me feel sick similar to flashing lights :(

    For now I went to Terrain Settings > Tree & Detail Objects > Draw and clicked it off to hide the trees but it'd be better if I could just have the trees always drawn while I'm editing terrain
     
  4. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    422
    The only way to do this, that I know of, is via code. All the paint tools have an OnPaint function with a bool as a return value. This boolean tells the tree renderer whether or not to hide the trees while painting
     
  5. SimonLevato

    SimonLevato

    Joined:
    Apr 4, 2017
    Posts:
    6
    Hey, I took the source code from the original paint texture tool from unity and added some changes that should not hide tree's while painting: https://pastebin.com/xMxnHua2
    Copy the code from the pastebin code > Create a new script under "YourProject/Assets/Editor" called "CustomPaintTextureTool.cs".
    You will now find a new tool in the "Paint Terrain"-dropdown, called "Paint Texture Custom".

    Explanation: I found the source code here https://github.com/Unity-Technologi.../TerrainEditor/PaintTools/PaintTextureTool.cs
    I renamed the class, renamed the tool name, and set OnPaint to return false (as @wyattt_ said in his reply).
    NOTE: I haven't tested this class, and you might need to have TerrainTools installed for this to work (https://docs.unity3d.com/Packages/com.unity.terrain-tools@4.0/manual/index.html). I'm at work and can't test it at the moment
     
    wyattt_ likes this.