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
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
- Editor crashes on D3D12GetInterface when repeatedly enabling and disabling 256 text components
- Flickering bright white dots in the Scene when the Android Platform is selected and DX11 Graphics API is used with Iris(R) Xe Graphics GPU
- Inconsistent capitalization and misaligned text in multiple query blocks in Search window
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
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.