Search Issue Tracker
Fixed
Fixed in 5.0.6, 5.1.2
Votes
16
Found in [Package]
5.0.3
5.1.0
Issue ID
WBTRB-105
Regression
No
Terrain Toolbox window causes an exception after entering and leaving play mode
Steps to reproduce:
# Load the attached project
# Ensure that the Terrain Tools window (Window/Terrain/Terrain Toolbox) is open and docked somewhere
# Open Scene Assets/Scenes/SampleScene.unity
# Enter & exit Play Mode
Expected result: nothing happens
Actual result:
MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEditor.TerrainTools.TerrainToolboxUtilities.RevertPreviewMaterial () (at /Users/ascentress/Desktop/lotad2/Library/PackageCache/com.unity.terrain-tools@5.0.0-pre.3/Editor/TerrainToolbox/TerrainToolboxUtilities.cs:2061)
UnityEditor.TerrainTools.TerrainToolboxUtilities.OnPlayModeChanged (UnityEditor.PlayModeStateChange state) (at /Users/ascentress/Desktop/lotad2/Library/PackageCache/com.unity.terrain-tools@5.0.0-pre.3/Editor/TerrainToolbox/TerrainToolboxUtilities.cs:2290)
UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:441)
Reproducible with any version that supports the Terrain Tools package versions 4.0.3 and above.
Package version: 4.0.3, 5.0.0-pre.3
Tested Editor versions: 2021.3.1f1, 2022.2.0b1
Comments (5)
-
Freshione
Jul 07, 2024 13:11
Tried FLAMINGJEZ solution but now my project has got bricked for modifying the script.
ScriptableSingleton already exists. Did you query the singleton in a constructor?
UnityEditor.PackageManager.UI.Internal.PackageManagerProjectSettings:.ctor ()Restarting fixes the error message, but now some parts of my game wont work.
-
rayanivanove
Jan 11, 2024 16:24
MELZERIA: You need to clear the error from the console before making the changes in visual studio, for some reason, and then it should work.
-
Melzeria
Jul 16, 2023 11:25
I tried your solution to fix this but everything I add the else and click on save, the script just automatically reverts back to what it had before and I keep getting the error message.
-
Om1010
Apr 02, 2023 15:08
Thanks FLAMINGJEZ, It totally worked and I learned something new that I could've never had!
-
FlamingJez
Aug 06, 2022 16:30
I fixed this myself as it was quite annoying. if you double click the error it should take you into the TerrainToolboxUtilities.cs. The error is that on line 1853 it's trying to call DisabledKeyword when m_PreviewMaterial is null. There's already an if statement checking if it's null, so i just added an else so the line only runs when m_PreviewMaterial has been assigned.
internal void RevertPreviewMaterial()
{
if (m_PreviewMaterial == null)
{
GetAndSetActiveRenderPipelineSettings();
}
else
{
m_PreviewMaterial.DisableKeyword("_SPLATMAP_PREVIEW");
}
for (int i = 0; i < m_Terrains.Length; i++)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Test Runner’s vertical scrollbar overlaps with the up and down arrows and upper toolbar tabs when the window is minimized
- The Input Field view is not updated when deleting lines of text
- The scrollbar does not respect empty lines in the Input Field
- “Texture Atlas Viewer“ button text overlaps another button when the UI Toolkit Debugger is narrowed
- Thresholds are no longer automatically calculated after deleting Motion fields in Blendtrees
Resolution Note:
Thank you for bringing this issue to our attention. Unfortunately, after careful consideration we will not be addressing your issue at this time, as we are currently committed to resolving other higher-priority issues.
We acknowledge that the current Terrain system has a number of limitations, so we are currently investing in a large amount of discovery work to determine exactly what is needed most and how we can bring it to you at the quality level you have come to expect and address the most pervasive pain points in the most effective and efficient manner. However, we know each case is different, so please do continue to log any issues you find, and provide general feedback on our roadmap page to help us prioritize.
Forum to discuss feature requests: https://forum.unity.com/threads/world-building-public-roadmap-and-feature-requests.1437163/
Roadmap: https://unity.com/roadmap/unity-platform/3d-world-building
Resolution Note (fix version 5.1.2):
Note: this issue was resolved in version 5.2.1 of the Terrain Tools package.