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

IMGUI

-

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

  1. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.