Search Issue Tracker

By Design

Votes

0

Found in

6000.0.20f1

Issue ID

UUM-82587

Regression

No

Custom Scene view Context Menu does not bypass the ordinary Context Menu shortcut

--

-

How to reproduce:
1. Create and open any project
2. Extract and import the “CustomContextMenu.zip” file into the Assets folder of the project
3. Click the Right Mouse Button within the Scene view
4. Observe the popped-up context menu

Expected result: A shortcut-bypassed Context Menu containing one (“Show Message“) item is displayed
Actual result: The ordinary Context Menu is displayed

Reproducible in: 6000.0.20f1
Could not test in: 2021.3.44f1, 2022.3.47f1 (Right-click Context Menu shortcut feature is not available)

Reproduced on: Windows 11 Pro (23H2), macOS 14.5 (by the reporter)
Not reproduced on: No other environment tested

Workaround:
1. Click and hold the Right Mouse Button over any Scene view Overlay
2. Drag the mouse onto the Scene view space
3. Release the Right Mouse Button

  1. Resolution Note:

    Hi, thanks for reaching out on that topic.

    With the new Scene Context Menu it's not possible anymore to replace that menu. The main reason is that this would not be a sustainable way to do. Indeed, if package 1 does its own menu and package 2 the same, and a user adds both in its project... that will create conflicts and the default unity menu won't be accessible.

    However, you can now add your own elements in that menu! Which is a lot more sustainable and that'll also enable multiple sulutions to co-exist without conflicting.

    In the case of your example, just making this function would add the item in that menu:
    [MenuItem("CONTEXT/GameObjectToolContext/Show Message")]
    static void ShowMessage()
    {
    Debug.Log("Right-click menu button clicked!");
    }

    That's even shorter than your script :D

    This example is extracted from that doc:
    https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Actions.EditorAction.html

    You can also have totally custom menu when activating a EditorToolContext (such as Probuilder or Splines packages are using). In that case you'll be able to fully override that menu.

    I invite you to read and comment the following post where we detail all of that even more and with more samples:
    https://discussions.unity.com/t/feature-highlight-scene-view-context-menu/1515899

    I hope this helps!

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.