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 with multiple stack traces when playing video on a render texture with low-end graphics devices
- Circle handle of the Game view scale slider bar disappears when the scale is set to 1x
- Asset Bundles non-deterministic behavior with CRCs and hash when a video has Transcoding enabled and Sprite Atlas has an override option enabled
- [Quality Hackweek] Errors "InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread" and "NullReferenceException" shown when switching build platforms with Muse Texture package installed
- "Importer(DefaultImporter) generated inconsistent result for asset" warnings are thrown when reimporting the "URP" texture
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.