Search Issue Tracker

Fixed in 2020.1.X

Votes

0

Found in

2020.1.10f1

2020.2.0b8

2021.1

2021.1.0a2

Issue ID

1287664

Regression

Yes

Error is thrown when entering the Play Mode while Inspector and Tile Palette are opened and GameObject with Grid is selected

2D

-

How to reproduce:
1. Open the attached "1287664" project
2. Open the Scene "SampleScene"
3. Make sure the Inspector window is visible (Window->General->Inspector)
4. Make sure the Tile Palette window is turned on anywhere (Window->2D->Tile Palette), doesn't have to be visible
5. Select the "Grid" GameObject
6. Keep entering and exiting the Play Mode until an error is thrown in the console (might take tens of tries for the error to appear)

Expected results: No errors are thrown when entering the Play Mode
Actual results: The "NullReferenceException: Object reference not set to an instance of an object" error is thrown when entering the Play Mode

Reproducible with: 2020.1.10f1, 2020.1.12f1, 2020.2.0b8, 2020.2.0b10, 2021.1.0a3
Not reproducible with: 2018.4.28f1, 2019.4.14f1, 2020.1.9f1, 2020.2.0a1, 2020.2.0b7

Notes:
- A Palette has to be selected in the Tile Palette window but the Palette can be empty
- This issue has been introduced from the case 1271740 fix (same error except it points to a different line in the script and slightly different requirements to reproduce the issue)
- The full error:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.GameObjectInspector.ClearPreviewCache () (at <859685c8158c480a8d135de9619162c9>:0)
UnityEditor.GameObjectInspector.ReloadPreviewInstances () (at <859685c8158c480a8d135de9619162c9>:0)
UnityEditor.GameObjectInspector.OnForceReloadInspector () (at <859685c8158c480a8d135de9619162c9>:0)
UnityEditor.Tilemaps.GridPaintPaletteClipboard:OnDisable() (at C:/Program Files/2021.1/2021.1.0a1_eff81b68729d/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.2d.tilemap/Editor/GridPaintPaletteClipboard.cs:347)

  1. Response avatar

    Resolution Note (fix version 2020.1):

    A fix for this issue will be available on Unity 2021.1.0a7 and above

Comments (6)

  1. 15bc6513843227de2cbabd81c0a58a1b?d=mm

    BlackUlrich

    Aug 28, 2021 23:17

    Still happening in 2020.3.14f1 and 2020.3.16f1

  2. 5ee2f6f72e76b9aadc49666e5d98440c?d=mm

    JDSherbert

    Aug 02, 2021 23:55

    Unity 2020.1.3f1
    I managed to fix the issue by replacing the line of code at line cs817 in GridPaintPaletteWindow.cs to this:

    if(clipboardView) DestroyImmediate(clipboardView);

    Hope this helps.

  3. Dfb0b23182849919f752bb64c6330c53?d=mm

    KingTempest07

    Jul 23, 2021 00:38

    Still happening in 2020.3.4

  4. 07f0171fede0e7b084c1261db696ece5?d=mm

    pitchblende

    Jun 12, 2021 04:34

    This still occurs occasionally for me with Unity 2020.3.3f1 - I think it might be a race condition because it seems intermittent. In my case I see it appear, sometimes, when the Tile Palette is open and I have an object in my scene with a TileMap component. I'm not sure but it seems to be related to which object is selected when I start the Player.

    Closing and reopening the Tile Palette made the issue go away, for a while.

    Looks like this is a related issue: https://issuetracker.unity3d.com/issues/error-is-thrown-upon-entering-play-mode-when-tile-palette-window-is-present-and-a-gameobject-with-a-grid-component-is-selected

  5. 4914c422e001b9c80b74ff69b48330be?d=mm

    randyleemaitland

    Apr 15, 2021 01:50

    I'm still seeing this too....

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

  6. Def2c8b39899fe76df448c74e9d87372?d=mm

    LordDarkenon

    Mar 21, 2021 19:02

    This is still an issue in 2020.3 LTS

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.