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
- NullReferenceException occurs when searching presets in “Select Preset” window after selecting a GLTF Importer preset
- Dynamic TMP_Font asset shows up as modified in source control when TextMeshPro text using it is changed
- “Output value ‘outMotionVec’ is not complete” warning logged after creating Canvas Shader Graph Asset
- SVG Image Component loses Source SVG Image field references when upgrading to a different Vector Graphics package version
- "TextMesh Pro Essential Resources are missing" error is logged after importing Essentials and closing TMP Importer opened by creating a TMP asset
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.