Search Issue Tracker
Won't Fix
Votes
0
Found in
2017.3.0f3
Issue ID
1021918
Regression
No
Editor hangs when faulty Dictionary is instantiated before variables used in functions like OnDrawGizmos().
When a script has a class variable of Dictionary type, that is attempted to be initialized with duplicate keys (resulting in an exception), then based on the order of variables in the file and which functions in the script are being called, the editor can hang (Memory usage keeps growing until it reaches 100% and the editor crashes).
In this particular case, due to OnDrawGizmos being used, and 'buildingMap' variable (Dictionary) being declared before 'gridSize' variable, which is used in OnDrawGizmos(), the editor gets into the hang state. Moving gridSize to be before 'buildingMap' declaration, or initializing 'buildingMap' from Start() method works around the problem.
How to reproduce:
1. Open attached project (case_1021918-Cloudship.zip)
2. In Project Window go to Scripts folder and open BuildSurface.cs
3. Change BuildSurface.cs line 17 "{ new Vector3(-2f, 0, 1f), true },"
to "{ new Vector3(-2f, 0, 0f), true }," in order to make a duplicate key.
4. Save the script.
Note the error: "ArgumentException: An element with the same key already exists in the dictionary."
5. Play the scene.
Expected result: Editor does not hang when faulty variables are instantiated before ones used in functions like OnDrawGizmos().
Actual result: Editor hangs when faulty variables are instantiated before ones used in functions like OnDrawGizmos().
Reproducible with: 2018.2.0a7, 2018.1.0b13, 2017.4.1f1, 2017.3.2f1, 2017.2.2p3, 2017.1.3p3, 5.6.5p3.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Mouse input is registered incorrectly in Custom RP when downscaling Render Target and rendering Overlay UI before final upscale
- Time.deltaTime is locked to the display's refresh rate when the built Player is moved to a Secondary Display and Windowed Mode is used
- Crash on RaiseException when importing a specific asset
- Crash on RaiseException when opening a specific project
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
Resolution Note:
Hi there,
We really appreciate your contribution to the Unity product. Thank you for reporting this issue. We take every case submitted to us seriously by investigating the impact on you, our customer, as well as the impact it may have on the engineering and experience of our product.
This particular case has been investigated thoroughly and we have decided, in the interests of protecting the stability and features of Unity for users that rely upon the affected versions, to not address this fix for the time being. We understand that this will cause problems for some users, and so may address in a future version.
Unity QA Team