"NullReferenceException: Object reference not set to an instance of an object"but in Unity files

I am getting this error Its not a normal NullReferenceException: Object reference not set to an instance of an object error its about my game files Its cant block my porjeckts I can switch play but I am getting

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.GameObjectInspector.ClearPreviewCache () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.GameObjectInspector.ReloadPreviewInstances () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.GameObjectInspector.OnForceReloadInspector () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.Tilemaps.GridPaintPaletteClipboard:OnDisable() (at C:/Program Files/Unity/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.2d.tilemap/Editor/GridPaintPaletteClipboard.cs:347)

1 Like

Looks like some custom inspector issue. Try reset layouts in your editor, which will close stray inspector windows that may no longer be valid because a script went away.

If it is in an inspector you wrote or that you control, the answer is always the same… ALWAYS. It is the single most common error ever. Don’t waste your life on this problem. Instead, learn how to fix it fast… it’s EASY!!

Some notes on how to fix a NullReferenceException error in Unity3D

  • also known as: Unassigned Reference Exception
  • also known as: Missing Reference Exception

http://plbm.com/?p=221

The basic steps outlined above are:

  • Identify what is null
  • Identify why it is null
  • Fix that.

Expect to see this error a LOT. It’s easily the most common thing to do when working. Learn how to fix it rapidly. It’s easy. See the above link for more tips.

This is the kind of mindset and thinking process you need to bring to this problem:

Step by step, break it down, find the problem.

3 Likes

I copied all save files and paste empty project ist worked I guess thanks for reply :slight_smile:

1 Like

Note the “PackageManager/BuiltInPackages/com.unity.2d.tilemap/Editor/GridPaintPaletteClipboard.cs:347)”
…so it might be some internal bug or edge case with the tilemap editor.

I had the exact same exception popping all the time and it definitely has something to do with the Tile Palette.
I had it open as a tab and just closing the palette stopped the exception.

8 Likes

Yeah just close the tab

2 Likes