Search Issue Tracker
By Design
Votes
0
Found in
2019.4.8f1
2019.4.10f1
2020.1.1f1
2020.2.0a20
Issue ID
1278432
Regression
Yes
MenuItem validate function is called twice and always returns a null MenuCommand.context first when right-clicking a GameObject
How to reproduce:
1. Open user-submitted project (MenuCommandNullContext.zip)
2. Open the GameObjectContextMenu.cs script
3. Change line 19 to always return 'true' and save
4. In the Hierarchy window right-click one of the GameObjects and select MyContext > Execute
Expected result: validate function is only called once and returns a successful validation because a GameObject is selected
Actual result: validate function is called twice, the first result returns a null MenuCommand.context and without changes to the script would cause the Execute option to be greyed out
Reproducible with: 2019.4.8f1, 2019.4.10f1, 2020.1.1f1, 2020.1.7f1, 2020.2.0a20, 2020.2.0b6
Not reproducible with: 2018.4.27f1, 2019.4.7f1, 2020.1.0a1, 2020.1.0f1, 2020.2.0a1, 2020.2.0a19
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
- Crash on do_runtime_invoke when reopening a specific project after failing to build it
- Animations change speed when rigidbody is added
- Low FPS persists when re-entering Play mode after an extended session in a specific project
- ListView list items in UIToolkit get stuck when reorderMode is set to Animated and they are reordered using two or more fingers on touch devices
- Editor or player crashes when using a deeply nested Particle System with a sub-emitter that has multiple references
Resolution Note (2021.1.X):
There has been recently a design change to fix case 1247020. As a part of this we are now calling the validate method while adding the menu item to the context menu. previously this was not the case. This was essential to determine whether the menu item should be added in enabled or disabled state. As a result, the user is getting call twice and the first one will not have any context.