- Home /
Terrain Tools, missing material bug in URP
Hi, I am trying to use Terrain Tools with the universal render pipeline (URP), but as soon as I've installed it, it throws me this error message:
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 Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainToolbox/TerrainToolboxUtilities.cs:1853) UnityEditor.TerrainTools.TerrainToolboxUtilities.OnPlayModeChanged (UnityEditor.PlayModeStateChange state) (at Library/PackageCache/com.unity.terrain-tools@4.0.3/Editor/TerrainToolbox/TerrainToolboxUtilities.cs:2082) UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at :0)
I've tried to resolve the problem, but nothing seems to have helped. Does anyone know what the problem is and how to fix it?
The error message pops up even if I don't have a terrain in my project but I can still run my scene and it plays normally.
Answer by SuperDK7 · Feb 26 at 01:33 AM
This happens in the "New Release" and "Preview" versions of the Unity Technology Terrain Tools. Double click the error message to edit the code. It will bring you to the line with the error. Add an IF statement so that it doesn't run the line if it is null if (m_PreviewMaterial != null) { m_PreviewMaterial.DisableKeyword("_SPLATMAP_PREVIEW"); //line with error }
Your answer

Follow this Question
Related Questions
Seasonal Terrain Trees From Script 1 Answer
Terrain painting with tessellated textures 2 Answers
How to change leave color at runtime? 1 Answer
Normal map on Terrain ? 1 Answer
My grass looks really weird. 0 Answers