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
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
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