Search Issue Tracker

Fixed in 2021.1

Fixed in 2020.1, 2020.2



Found in




Issue ID




Error is thrown upon entering Play Mode when Tile Palette window is present and a GameObject with a Grid Component is selected



How to reproduce:
1. Open the attached "1271740 repro" project
2. Open the "SampleScene" Scene from the Assets folder
3. Select the "Grid" GameObject from the Hierarchy window
4. Switch the Inspector window to Debug mode
5. Enter and exit Play Mode
6. Repeat step 5 until a NullReferenceException error is thrown in the Console window

Expected results: no errors are thrown in the Console after entering Play Mode
Actual results: NullReferenceException error is thrown upon entering Play Mode

Reproducible with: 2020.1.3f1, 2020.2.0a16, 2020.2.0a21
Not reproducible with: 2018.4.26f1, 2019.4.9f1, 2020.2.0a15

-Sometimes the issue reproduces on the first attempt but usually requires up to 7 attempts
-Tile Palette window must be open or docked somewhere with a Palette selected (an empty Palette in the selection is enough to reproduce the issue)
-A GameObject with a Grid Component must be selected in order to reproduce the bug
-The issue only reproduces when the Inspector window is in Debug mode.
-The Inspector and Tile Palette windows don't have to be visible, having them docked somewhere in the Editor is enough
-The full error message is:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.GameObjectInspector.ClearPreviewCache () (at <1ad84465318248ca98d7f06a0a057e63>:0)
UnityEditor.GameObjectInspector.ReloadPreviewInstances () (at <1ad84465318248ca98d7f06a0a057e63>:0)
UnityEditor.GameObjectInspector.OnForceReloadInspector () (at <1ad84465318248ca98d7f06a0a057e63>:0)
UnityEditor.Tilemaps.GridPaintPaletteWindow:OnDisable() (at E:/UnityVersions/2020.2/2020.2.0a21_3e0d5f775006/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.2d.tilemap/Editor/GridPaintPaletteWindow.cs:842)

  1. Response avatar

    Resolution Note (fix version 2021.1):

    Fixed in 2021.1.0a1

  2. Response avatar

    Resolution Note (fix version 2020.2):

    A fix for this issue is available on Unity 2020.2.0b8 and above

  3. Response avatar

    Resolution Note (fix version 2020.1):

    A fix for this issue is available on Unity 2020.1.10f1 and above

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.