Search Unity

Official Survey and Discussion - "Right-Click" (contextual) menu in the Scene View

Discussion in 'World Building' started by gabrielw_unity, Sep 6, 2022.

  1. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    **DISCLAIMER** This is an early survey only, no actual feature or timeline is implied or guaranteed.

    Hi there! We are beginning explorations for a "right-click menu" in the Scene View. Meaning, the fairly standard ability to right-click (or other shortcut) in the Scene View, and see a menu appear with contents matching the context.

    The intent here is to gather basic expectations and general feedback, before considering further. If enabled, this would be a major UX change for Unity, and we want to ensure everyone has a chance, early on, to discuss this.

    Please take a few minutes to fill out the short survey HERE, and use this thread for discussion. Thank you for your time and input!
     
    GDevTeam and Wattosan like this.
  2. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,745
    All your presenting is to take what we already can do by right clicking the asset (lets say a rock), in the hierarchy and making it easier by just right clicking the object itself in-scene. Im not opposed to this idea, as other progs do this.

    I feel im not understanding exactly what your goal is. Does this mean the right click in the hierarchy will be removed, and only accessable from right clicking the object in-scene?. Maybe showing an example would better help people understand what you are presenting.
     
  3. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi Warthos :) I'm keeping it fairly general on purpose here, to not bias answers. To clarify a bit though - this is adding a new feature, not changing or removing others. The main benefit being to artists, who could now interact with an item directly in their view, vs needing to move over to the hierarchy and find the item there.

    Additionally, it opens up exciting new ways to interact with items not shown in the Hierarchy - vertices on meshes, spline points, tiles, etc.
     
    joshcamas, GDevTeam and warthos3399 like this.
  4. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,745
    Thanks for clarifying that. I think its a great idea to impliment, and would speed up project time, my personal one is delete, so many times i just want to click and delete (as i do in other progs), and not have to make an additional process to do so.

    Moving (not removing) the right clicking menu in the hierarchy, to a right click in-scene would be great, and then elaborating on it would really help. Love the idea, thanks for your effort, appreciated :)
     
    gabrielw_unity likes this.
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    This thread never got any attention! womp womp.

    So in general yes, a thing like a right click menu that's invokable in the scene view is nice. It can't be on rmb since that's already used to rotate the camera and differentiating between click and drag is annoying and bad.


    One of the worst things about using Unity today is the difficulty of selecting things in the scene view. Especially in 2D games, you end up with a lot of transparent elements overlapping each other, and selecting the one you want is super annoying. You can end up clicking the same pixel 10+ times to get to the object you want. Prefabs and [SelectionBase] just not cooperating with each other does not help at all.

    The obvious solution, to me, is to have a pop-up menu you can bring up under the mouse that shows a hierarchy of all the objects that's under the mouse. We can do this ourselves (and have, at times!), but that's based on renderer/collider bounds, which is not as accurate as the algorithm Unity uses to decide what object(s) the mouse is over or not.

    A nice way to solve this partially for us (so we can make neat tools for our workflow instead of you having to fumble around to find a general purpose one) is to do two things:
    - Make it easy to open a temporary Overlay under where the mouse is (so we don't have to fiddle with drawing UI in DuringSceneGUI)
    - Expose the internal function that has to exist somewhere that decides "which objects are under the mouse" that's used to cycle through objects when we click in the scene view.
     
    joshcamas and GDevTeam like this.
  6. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hey Baste! Sorry I'm late to reply!

    So, RMB - I'm not sure what the issue is? It's standard to use LMB click, and LMB drag separately. RMB is the same thing, different button. And RMB is the most common solution for this sort of menu, so it seems the best option. Most importantly though, it'll be 100% customizable, as all mouse, keys, and modifiers are now :)

    Selection - 100%, and I'm in the process of designing out how this could work for us, right now. No promises when/if/etc, of course. Taking the same approach you mention - as pretty much ever good DCC does - pop up menu with items at pixel. Further though, I think we desperately need a proper type-filtering solution ... also a standard in DCCs (except Unity :p). Eg, you could disable selection of all items with UI components, etc.
     
  7. unity_pQirYwzPLiEXiw

    unity_pQirYwzPLiEXiw

    Joined:
    Nov 29, 2017
    Posts:
    2
    Sorry for a not so much related discussion.
    We have good experience with the Selection Utility Tool. This help us select overlapped objects In 2D game.
    https://assetstore.unity.com/packages/tools/utilities/selection-utility-179537#version-current

    But in 2022 the temporary pan tool implementation changed and make sceneView stuck at the Pan Tool.
    SceneView become stuck when show a popup window with right click in SceneView.duringSceneGUI.
    Selection Utility set GUIUtility.hotControl to 0 to get rid of the stuck.

    2021 implementation
    Code (CSharp):
    1. static void UpdateViewToolState(Event evt)
    2.         {
    3.             bool shouldBeActive = false;
    4.             if (GUIUtility.hotControl == 0 || Tools.s_LockedViewTool != ViewTool.None)
    5.             {
    6.                 bool viewShortcut = evt.type != EventType.Used && (evt.alt || evt.button == 1 || evt.button == 2);
    7.                 shouldBeActive = Tools.s_LockedViewTool != ViewTool.None || Tools.current == Tool.View || viewShortcut;
    8.             }
    9.             if (shouldBeActive != s_ViewToolActive)
    10.             {
    11.                 s_ViewToolActive = shouldBeActive;
    12.                 viewToolActiveChanged?.Invoke();
    13.             }
    14.         }
    15.  
    2022.2 implementation
    Code (CSharp):
    1. static void UpdateViewToolState(Event evt)
    2.         {
    3.             bool shouldBeActive = false;
    4.             if (evt?.type == EventType.MouseDown)
    5.             {
    6.                 var eventKeyCombination = new[] { KeyCombination.FromInput(evt) };
    7.                 foreach (var shortcut in ViewToolShortcuts)
    8.                     shouldBeActive |= shortcut?.StartsWith(eventKeyCombination) ?? false;
    9.             }
    10.  
    11.             shouldBeActive |= Tools.s_LockedViewTool != ViewTool.None || Tools.current == Tool.View;
    12.             if (shouldBeActive != s_ViewToolActive)
    13.             {
    14.                 s_ViewToolActive = shouldBeActive;
    15.                 viewToolActiveChanged?.Invoke();
    16.             }
    17.         }
    Any suggestion to fix the problem? We are eager to have a project version change due to Mac M1 crash problem.
     
    Last edited: May 25, 2023
    Xarbrough likes this.
  8. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    @gabrielw_unity

    So this is why my right click menu got messed up since 2022.2 for Interactor.

    Normally if my spawner window is opened, right click in sceneview (within specified double click time as ms) opens a spawner menu which allows users to select prefabs to spawn on clicked position/object.


    But since 2022.2, it gets stuck with sceneview camera movement (like EventType.MouseUp is never happened) when menu pops up.

    So how can these two coexist when you implement this?
     
    kickasslin likes this.
  9. Game-Dragon

    Game-Dragon

    Joined:
    Nov 16, 2012
    Posts:
    33
    Has a solution for this been found? Would really like to add a right click menu to 2022.3, but this issue makes it quite annoying.
     
  10. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
  11. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Hi @gabrielw_unity

    Is there a way to disable contexual menu for a while in the api?

     
  12. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hey @razzraziel! Sorry for the delay, was on vacation. I think the correct solution, would be to utilize the Shortcut Manager system. That will avoid conflicts, and let your users pick whatever key/combo they like (for yours, and ours).