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.

Bug Brush Mask Filter Unity 2021.2.16f1 - Terrain Tools Version 4.0.3

Discussion in 'World Building' started by MrAkroMenToS, Mar 19, 2022.

  1. MrAkroMenToS

    MrAkroMenToS

    Joined:
    Nov 16, 2013
    Posts:
    37
    Unity 2021.2.16f1 - Terrain Tools Version 4.0.3

    Repro:
    - Create a new project based on the HDRP Empty template
    - Add Terrain Tools v4.0.3 package
    - Create terrain
    - Click on "Paint Terrain" (if not already selected)
    - notice error messages

    The issue comes up with all modes where you can set Brush mask filters

    WORKAROUND:
    I can add *any* filter, and disable it, then the error goes away.


    The two errors that show up when I click on the terrain:

    Code (CSharp):
    1. Retrieving array element that was out of bounds
    2. UnityEditor.TerrainTools.FilterStackView:ElementHeightCB (int)
    3. UnityEditorInternal.ReorderableList:CacheIfNeeded ()
    4. UnityEditorInternal.ReorderableList:GetListElementHeight ()
    5. UnityEditorInternal.ReorderableList:DoLayoutList ()
    6. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.TerrainTools.FilterStackView.GetFilterAtIndex (System.Int32 index) (at Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainTools/FilterStack/FilterStackView.cs:413)
    3. UnityEditor.TerrainTools.FilterStackView.ElementHeightCB (System.Int32 index) (at Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainTools/FilterStack/FilterStackView.cs:221)
    4. UnityEditorInternal.ReorderableList.CacheIfNeeded () (at <ed149e892fca4713a3001773d054b5ca>:0)
    5. UnityEditorInternal.ReorderableList.GetListElementHeight () (at <ed149e892fca4713a3001773d054b5ca>:0)
    6. UnityEditorInternal.ReorderableList.DoLayoutList () (at <ed149e892fca4713a3001773d054b5ca>:0)
    7. UnityEditor.TerrainTools.FilterStackView.OnGUI () (at Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainTools/FilterStack/FilterStackView.cs:111)
    8. UnityEditor.TerrainTools.BaseBrushUIGroup.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.TerrainTools.IOnInspectorGUI editContext, UnityEditor.TerrainTools.BrushGUIEditFlags brushFlags) (at Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainTools/BrushControllers/BaseBrushUIGroup.cs:454)
    9. UnityEditor.TerrainTools.PaintHeightTool.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.TerrainTools.IOnInspectorGUI editContext) (at Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainTools/PaintHeightTool.cs:75)
    10. UnityEditor.TerrainInspector.ShowPaint () (at <ed149e892fca4713a3001773d054b5ca>:0)
    11. UnityEditor.TerrainInspector.OnInspectorGUI () (at <ed149e892fca4713a3001773d054b5ca>:0)
    12. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <182296579622473385aae82a7777a7d5>:0)
    13. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    14.  

    Issue tracker ref: https://fogbugz.unity3d.com/default.asp?1411980_o6ensdn4752q6ocd
     
  2. marvelescent_unity

    marvelescent_unity

    Joined:
    Mar 1, 2022
    Posts:
    7
    Just wanted to add, exact same version, exact same errors. Same happened with 2020.3.31f1 for me, which is why I upgraded so far up, still had the issue!

    Update: Was able to stop the errors, but still not able to sculpt. Most say read only, and if it doesn't it still doesn't draw.
     
    Last edited: Mar 24, 2022
  3. MrAkroMenToS

    MrAkroMenToS

    Joined:
    Nov 16, 2013
    Posts:
    37
    (You didn't say, I'm just assuming) After you added the filter, did you disable it? An active filter might be the reason why you can't sculpt. You have to click the eye icon, if it's crossed out it's disabled (and you should be able to draw)
    upload_2022-3-24_20-24-37.png upload_2022-3-24_20-24-50.png
     
  4. marvelescent_unity

    marvelescent_unity

    Joined:
    Mar 1, 2022
    Posts:
    7
    Yes, i disabled it. The only aspect i didn't copy, was putting it on every single tab, since there are a lot of options and since it wasn't working, it seemed like i was wasting my time.
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,169
    This only seems to work for me once before having to apply the hotfix. Is there any hope for a permanent solution or should I just write off this entire package? Even actions as simple as undo throw errors into the console.
     
  6. BigBrotherLee

    BigBrotherLee

    Joined:
    Oct 31, 2016
    Posts:
    11
    I change to unity 2021.2.14, error disapear
     
  7. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,169
    That's not much solace for those of us using the LTS branch, which is allegedly supported, for a reason.
     
    FlightOfOne and Walter_Hulsebos like this.
  8. Walter_Hulsebos

    Walter_Hulsebos

    Joined:
    Aug 27, 2015
    Posts:
    21
    Still happens in 2021.2.17f1
    __UNITY_TERRAIN_TEAMS_INCOMPETENCE.png
     

    Attached Files:

  9. BigBrotherLee

    BigBrotherLee

    Joined:
    Oct 31, 2016
    Posts:
    11
    I guess this bug is caused by unity editor property class.I have a plugin have same bug.So, i have to fixed it. For terrain tools, you can copy the package folder to [your unity project]/packages , and then, find FilterStatckView.cs, modify as image:
     

    Attached Files:

  10. BigBrotherLee

    BigBrotherLee

    Joined:
    Oct 31, 2016
    Posts:
    11
    before that, you need copy TerrainTools package to desktop, and remove the package from unity package manager, then copy desktop package to [your unity project]/packages, so that you can modify like image
     
  11. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    40
    Well technically, the terrain tools are in preview packages which may or may not have issues on LTS.
     
  12. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,169
    There's a difference between "having issues" and "this tool literally errors out if you perform the most basic of tasks"
     
    Walter_Hulsebos likes this.
  13. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    40
    This still the case in 2021.2.19f1. I sure am curious why this isn't fixed yet. Unless there are some integration issues with this asset, this is only a few lines of code to fix.
     
    zetaFairlight likes this.
  14. firesightstudios

    firesightstudios

    Joined:
    Mar 29, 2022
    Posts:
    40
    Same problem in 2022.1.0b15.2990 Except it gets worse, the terrain won't raise or lower properly.
    Honestly, I can't even find a stable editor version to make a game lol.
     
    Last edited: Apr 9, 2022
  15. dexmex001

    dexmex001

    Joined:
    Oct 9, 2019
    Posts:
    23
    Hi, Thanx a lot BigBrotherLee, its worked for me
     
  16. niuage

    niuage

    Joined:
    Nov 17, 2019
    Posts:
    76
    Whoever built these tools at Unity, pleaaaase look into that issue, that'd super appreciated.
     
    Walter_Hulsebos likes this.
  17. MrAkroMenToS

    MrAkroMenToS

    Joined:
    Nov 16, 2013
    Posts:
    37
    Just updated to the LTS version and the issues is still not fixed. Terrain Tools is advertised in the release video around the 41 second mark:


    Can we please get a confirmation that Unity is working on the issue or is there a problem reproducing it? Can we help somehow?

    Pinging @DanielTG because you're the last person from the Team to answer on this forum, sorry for the ping but I'd like to have some visibility on this issue.
     
    wyattt_ and Walter_Hulsebos like this.
  18. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    592
    Anyone else having problems with the Terrain Samples from the asset store link?
    They caused Unity to get stuck in a spiral of 'invalid package dependencies' spiral and I ended up nuking my project entirely.
     
  19. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Hi. Which version of Unity were you using for this? And to which asset store link are you referring? Thanks
     
    Last edited: Apr 21, 2022
  20. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Hello to everyone else as well. We're aware of the issue with the brush mask filters errors and being unable to paint from the start and are looking into it.
     
    MrAkroMenToS likes this.
  21. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    592
    I am using 2021.3LTS

    This asset link
    is found here:
    upload_2022-4-21_17-33-11.png
     
    wyattt_ likes this.
  22. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
  23. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Ok. So, I first tried to import the package using the default renderer in 2021.3.0f1 and got that error in the console. I then tried with a new HDRP project and successfully imported without issue. So my guess is the assets depend on URP/HDRP for the most part seeing as they details shaders are done with ShaderGraph.

    Which template did you use for the project when you ran into this issue? And what kind of spiral? Is it a spiral involving the dialogue window never going away or there's a message about invalid package dependencies in the console window once the asset package is done importing?

    Thanks.
     
  24. wangtaoETO

    wangtaoETO

    Joined:
    Apr 15, 2021
    Posts:
    2
    2021.3.1 The error still exists
     
  25. MaxKMadiath

    MaxKMadiath

    Joined:
    Dec 10, 2016
    Posts:
    58
    I am working on the Latest 2021 LTS HDRP but I can't see the brush mask options. Any Help
     
  26. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Hi. Could you share some screenshots?
     
  27. sisseltp

    sisseltp

    Joined:
    Dec 5, 2021
    Posts:
    1
    Terrain tools also stopped working for me, with the same errors as mentioned above. I feel like I tried everything, but when I use the Raise/lower terrain and the paint textures when Terrain Tools are enabled the brushes become sort of glitchy (like they are flickering between large and small size for no apparent reason, and don't actually do what they're supposed to do) while I get the same errors as mentioned above. This is a completely new issue for me and very frustrating!
     
  28. MaxKMadiath

    MaxKMadiath

    Joined:
    Dec 10, 2016
    Posts:
    58
    When I change the option terrain texture to raise or lower or any other option this error occur. Aftet that I need to select any other game object and back terrain again. My screen is 4k.
    upload_2022-4-30_10-53-57.png
     
    Last edited: Apr 30, 2022
    minsumandoo and wyattt_ like this.
  29. anothervictoriaa

    anothervictoriaa

    Joined:
    Aug 8, 2021
    Posts:
    2
    I am sorry. Can you or anybody explain where can I find that file? I tried but cannot find it.
     
  30. dexmex001

    dexmex001

    Joined:
    Oct 9, 2019
    Posts:
    23
    Hello,

    This method worked for me:

    1. First BackUp your project, and exit from Unity

    2.
    Copy the original package TerrainTools4.0.3 an another folder (example x:/UBUGFIX/PatchedTerrainTools4.0.3)
    Copy from:
    X:\YourProject\Library\PackageCache\com.unity.terrain-tools@4.0.3\

    3.
    Change or modify the following file in the saved package directory x:/UBUGFIX/PatchedTerrainTools4.0.3 (FilterStackView.cs)
    X:\YourProject\X_2021_2\Library\PackageCache\com.unity.terrain-tools@4.0.3\Editor\TerrainTools\FilterStack\FilterStackView.cs
    Need modify this filter:
    private Filter GetFilterAtIndex(int index)
    {
    //Bug 2022
    //return m_FiltersProperty.GetArrayElementAtIndex(index).objectReferenceValue as Filter;
    if (m_FiltersProperty.arraySize <= index) { return null; }

    var v = m_FiltersProperty.GetArrayElementAtIndex(index);
    if (v == null) { return null; }
    return v.objectReferenceValue as Filter;
    }

    4.
    Modify the manifest.json file in your project (add the follwing line where file: x:/UBUGFIX/ is your modificated "BugFixed" version of Terrain tool package)
    X:\YourProject\Packages\manifest.json
    Add this line
    "com.unity.terrain-tools": "file:x:/UBUGFIX/PatchedTerrainTools4.0.3/",

    This package redirection needed, otherwise if you reopen the project its download and overwrite it.

    Hope its help, Good luck
     

    Attached Files:

    SorraTheOrc likes this.
  31. anothervictoriaa

    anothervictoriaa

    Joined:
    Aug 8, 2021
    Posts:
    2

    Thank you for your reply! I am not sure, maybe I don't understand right. I tried but had some issues. Can I ask you in more details if it is possible when your answer was very detailed.

    I need to copy the com.unity.terrain-tools@4.0.3\ folder to the desktop, so there won't be a folder in the original pathway, I mean in in PackageCashe? Or should I just duplicate it to desktop?

    If the second sentence is right, should I change that file FilterStackView.cs only in the desktop folder or in both?

    Because I am making all this steps this evening and I think I make smth in a wrong way.
    - I moved that folder to desktop. Changed that file. Then modified JSON file with the path to that package on desktop. And then redirected that folder to original PackageCache folder.
    And there was an error while opening the project, that there was a mistake in json file.
    What I am making wrong?
    Sorry for the most nubiest question, it is the first time I have errors that don't let me to continue working on my project.
    Thank you so much for your attention!
     
  32. dexmex001

    dexmex001

    Joined:
    Oct 9, 2019
    Posts:
    23
    Hi Anothervictoriaa,

    I used Unity version 2021.2.19f1 (but i think its work on other version too)

    Just make a copy from original TerrainTool and modify the copy. Let the original folder and content on the place.
    If at project open You got manifest.json file error, maybe the modified path not correct in the json file, or missing "," comma or forgot change backslast "\ " to "/" slash.
    Need use a right text editor like Notepad++

    I send You a detailed PM (check your inbox) its contain another example.

    Have a nice day
     
  33. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Hi. This sounds like maybe there's a jitter value on the Brush Settings. Can you check and make sure it is set to 0 for Brush Size? You can access it by clicking the arrow or triangle that is to the left of the Brush Size label in the Terrain Inspector when you've got a Terrain Tool active.
     
  34. hgrajda

    hgrajda

    Joined:
    Aug 3, 2021
    Posts:
    1
    upload_2022-5-9_16-37-51.png

    I got the same issue, also when I change mode from paint texture to set height for example, it crashes the inspector till i minimize the terrain component. 2021.3.2f1
    In my case I updated project from 2020.3.23f1, Jitter value is set to 0 by default. Probably Terrain Sample asset pack made the errors.
     
    FlightOfOne likes this.
  35. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Hi. The jitter suggestion is separate from the errors you are seeing. For the errors and UI issues, this is an issue with either the Terrain Tools package or the serialization that the package relies on. As a workaround, you can try adding a Brush Mask filter to the Brush Mask filters section of the Paint Texture UI (something like the Abs filter) and then disable the filter by clicking the eye icon.
     
  36. Ultroman

    Ultroman

    Joined:
    Mar 10, 2014
    Posts:
    104
    I just want to add, that we are seeing the same things using URP in Unity 2021 LTS.
     
    Last edited: May 19, 2022
    wyattt_ likes this.
  37. SorraTheOrc

    SorraTheOrc

    Joined:
    Jun 11, 2016
    Posts:
    137
    This worked for me and has taken away hours of pain. Thank you very much for taking the time to document it here.

    @Wyatt_ you said Unity was looking into it in April, a solution is provided here in May. Can you please ensure that this is patched as soon as possible. It's not an edge case, even if the provided solution has some side effects the package is more usable with it than without.
     
    dexmex001 likes this.
  38. MrAkroMenToS

    MrAkroMenToS

    Joined:
    Nov 16, 2013
    Posts:
    37
    I got an update from the Unity support saying that (and I'm paraphrasing) they are unable to repro the issue... When @wyattt_ you were clearly able to repro, could we please get a (real) update?
     
  39. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Hey, all. I'll check with the team to see if this has been fixed. If it has, it would be available in the next release
     
  40. dexmex001

    dexmex001

    Joined:
    Oct 9, 2019
    Posts:
    23
    Hi SorraTheOrc,

    I just follow BigBrotherLee instructions.
    Thx your feedback, I'm glad I could help.
     
    SorraTheOrc likes this.
  41. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    Looks like this was fixed for next release(s)
     
    dexmex001 likes this.
  42. avataris-io

    avataris-io

    Joined:
    Jun 23, 2020
    Posts:
    23
    we have the same error for Unity 2021.3.8
     
    Walter_Hulsebos likes this.
  43. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    287
    @wyattt_ In which versions these errors are fixed?. I am using 2021.3.2 and same errors. I am using BIRP and terrain tools 4.0.3
     
    zetaFairlight likes this.
  44. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    411
    I think they are fixed in 5.x
     
    Walter_Hulsebos likes this.
  45. SadisticLotus

    SadisticLotus

    Joined:
    Oct 8, 2019
    Posts:
    25
    Im still having the issue
     
  46. Walter_Hulsebos

    Walter_Hulsebos

    Joined:
    Aug 27, 2015
    Posts:
    21
    5.x isn't available in Unity 2021 LTS, unfortunately. They made a major release out of it rather than a patch it seems.
     
    SadisticLotus likes this.
  47. SadisticLotus

    SadisticLotus

    Joined:
    Oct 8, 2019
    Posts:
    25
    I seee, any info when it might get released?
     
  48. izzanfuad

    izzanfuad

    Joined:
    Dec 7, 2021
    Posts:
    15
    I'm still stuck at step 4. It always return error duplicated keys in near D:/
     
  49. DBTX1

    DBTX1

    Joined:
    Oct 21, 2021
    Posts:
    2
    [POSSIBLE SOLUTION]

    This is what I have done to fix this issue:

    First of all I worth to mention that I was using 2021.3.10f1 and a HDRP project. Terrain tool was working fine (with some issues placing grass/trees) at the begining but kinda sorted. For some reason after a couple of weeks the terrain tool was throwing at me this error and here I am. And after reading most of the comments and not understanding anything... I decided to uninstall the terrain tool, upgrade from 21.3.10 to 21.3.20 and it worked.

    Do not install the terrain tool again from the package manager as it will throw the errors again. And yes, it is weird but you still have the terrain tool without the package being installed or removed.

    I hope it helps.
     
  50. dexmex001

    dexmex001

    Joined:
    Oct 9, 2019
    Posts:
    23
    Sorry for the late reply

    Maybe at step 4 your manifest.json file somwhere contains this row (not sure just an idea)
    "com.unity.terrain-tools": "4.0.3",

    Remove it and try using (where the x:/UBUGFIX is your path)
    "com.unity.terrain-tools": "file:x:/UBUGFIX/PatchedTerrainTools4.0.3/",

    EDIT:
    I have not experienced this bug in Unity 2021.3.14f1 LTS version
    Terrain Tools working well.

    At upgrade I create a new clear project, install the components, what i use.
    After this, copy my own (created) assets to this clear project.

    My opinion this is the best clear upgrade, with this solution i have no problems.
    You can copy (transfer) the Layer, Physics, TAG settings from YourProject\ProjectSettings\ folder
     
    Last edited: Mar 13, 2023