Search Issue Tracker

Not Reproducible

Votes

1

Found in

2019.4

2020.3

2020.3.22f1

2021.2

2022.1

2022.2

Issue ID

1393672

Regression

No

NullReferenceException thrown and mouse breaks when calling EditorUtiliy.DisplayDialog in GridBrush.BoxFill/GridBrush.BoxErase

Windows

-

Reproduction steps:
1. Open the attached project "1393672repro.zip"
2. Open "SampleScene"
3. Select "Tilemap" in the Hierarchy window
4. Select "Paint with active brush" in the Tile Palette window
5. Click anywhere in the Scene view
6. Close the DisplayDialog, click outside of the Scene view
7. Try to switch from Project window to Console

Expected result: No errors are thrown
Actual result: NullReferenceException is thrown, clicking outside of Scene view makes DisplayDialog pop up, switching tabs takes an extra click

Reproducible with: 2019.4.36f1, 2020.3.30f1, 2021.2.15f1, 2022.1.0b11, 2022.2.0a7

Notes:
1. Not reproducible on macOS
2. To stop DisplayDialog from popping up outside of the Scene view, click outside of the Editor, then go back to the Editor
3. In 2022.1.0b11 and 2022.2.0a7, there is no exception or DisplayDialog popping up outside of Scene view but switching tabs is not possible after closing DisplayDialog
4. In 2021.2.15f1, clicking outside of Scene view does not make DisplayDialog pop up but the exception is thrown and switching tabs is not possible
5. In 2019.4.36f1, the exception is not thrown but clicking outside of Scene view makes DisplayDialog pop up

Comments (1)

  1. ai-kut-to

    Mar 18, 2022 06:42

    As a workaround I am using the method below while waiting for a fix:

    - When a BoxFill command comes. It is handled by a coroutine so called FillCoroutine().
    - FillCoroutine waits for the mouseUp if it needs to show a DialogBox for the designer for a potential paint mistake. For catching the mouseUp I used the "bool executing" parameter of OnPaintSceneGUI method.

    My theory is that for some reason if you trigger dialogBox -via EditorUtility.DisplayDialog- before the mouseUp event occurs -when painting onto grid- some values are not set and you get a NullRefException.

    Note: Clicking around the editor 1-2 times restores the state and you can continue your work as a designer. BUT it occasioanly crashes the Unity too. And that makes the designers work to be lost when not working with autosave option enabled on prefabs.

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.