How to solve MissingReferenceException error with Unity Terrain Package?

87 Views Asked by At

Building a small game in Unity using URP, currently have two scenes, the second scene (without a terrain but a 'room') is the one I'm having issues with. This error appears in the console when I play: '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/[email protected]/Editor/TerrainToolbox/TerrainToolboxUtilities.cs:2061)
UnityEditor.TerrainTools.TerrainToolboxUtilities.SaveSettings () (at ./Library/PackageCache/[email protected]/Editor/TerrainToolbox/TerrainToolboxUtilities.cs:2224)
UnityEditor.TerrainTools.TerrainToolboxWindow.OnDisable () (at ./Library/PackageCache/[email protected]/Editor/TerrainToolbox/TerrainToolboxWindow.cs:82)

As I understand a Terrain script needs to reference object type 'Material', however, I'm not sure how I do that. I'm not familiar with working with cache files in Unity.

I've recently deleted the 'EasyRoads' package from my project folder as I decided I didn't want to use it so thought I'd save the room. Not sure if this could've created the problem.

Also tried creating object called 'Material' as detailed in solution from (Unity | MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it).

Help would be great!

0

There are 0 best solutions below