Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Smart Ui Selection - Unity Editor Extension

Discussion in 'Assets and Asset Store' started by _geo__, Jul 9, 2019.

  1. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    66
    Smart UI Selection
    Asset Store | Documentation | Support


    This asset improves the selection by ignoring empty ui elements and allows for click-through selection of 3D objects behind the canvas. It fixes the (sometimes) unexpected order of ui selections done by the editor (what you see is what you select).

    It also addresses the issue that the screen space overlay canvases are quite often in the way of selecting anything in the 3D scene. It does so by disabling those canvases if you get very close to them. This feature is disabled by default. You can easily turn it on in the settings (Tools -> Smart Ui Selection -> Turn Auto Hide On).

    It will not add any runtime scripts or objects to your scene/project (editor only). Files are located in Plugins/../Editor/.. .

    DEMO VIDEO







    FEATURES

    1. What you see is what you select.
    Ignore empty ui elements and enjoy a predictable selection order. UI elements in front will always be selected first.

    2. Select 3D objects behind any canvas.
    Click-through empty canvas areas. No need to whirl the camera around or disable the canvas just so you can select that one 3D object in the back.

    3. Auto hide canvases at close range.
    Useful if you often switch between ScreenSpace canvases and the 3D scene. This feature is disabled by default. You can enable it in the settings.

    4. Full source code included

    5. Compatible with Unity 5.3.6f1+, 2017.x, 2018.x, 2019.x
    It may work with earlier versions too but I haven't tested it. I guess not too many people are still using 5.x.

    6. Please notice that this is an EDITOR ONLY plugin.
    It enhances the ui selection functionality in the SceneView of the Unity Editor.

    Usage
    A new menu called "Smart Ui Selection" will be available under "Tools" in the main menu bar. Go check it out once the import is done.

    Links
    Asset Store | Documentation | Support

    Let me know what you think or post questions below if you have any, thanks.
     
    Last edited: Jul 10, 2019
    Circool likes this.
  2. j_hansen

    j_hansen

    Joined:
    Oct 13, 2017
    Posts:
    3
    I really like this asset, here is a few suggestions based on the project I currently work on.

    We have quite a canvas (2d game) that we generally don't work in, I have added this to allow be to ignore them by name:
    SmartUiSelection.cs@284
    if (canvases[c].enabled && !SmartUiSelection_Settings.excludeByName.Contains(canvases[c].name))

    We also use nested canvases, so I also added this:
    SmartUiSelection.cs@290 (at the beginning of the recttransform loop):
    if(rectTransforms.GetComponentInParent<Canvas>() != canvases[c])
    {
    // is in a nested canvas
    continue;
    }

    I also changed the "push to use" a bit. If it's not enabled, holding space will disable Smart selection:
    // ignore events if activation key is not pressed (only if "push to use" is activated).
    if (SmartUiSelection_Settings.pushKeyToUseUiSelection != _isSpacePressed)
    {
    return;
    }
     
  3. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    66
    Hi @j_hansen ,
    thank you for using my asset and also thank you for your suggestions.
    I'll definitely add the "ignore canvases" (with sub canvases) feature.

    I am not sure about the "If it's not enabled, holding space will disable Smart selection" bit. This may confuse (old) users, since that would be a quite surprising change in behaviour. So I guess I'll have to skip this for now, sorry.
    What was it that you wanted to achieve with it?
    I assume you want to have SmartUI always on and just turn it off with space in cases where you want to check if the native selection works better. If I am right, then can you please share when/why you needed that?

    Unity usually needs quite some time to review and approve new updates in the Asset Store. Let me know (PM) if you need a patched version and I will provide one for you. The newest version also allows you to ignore elements by tag. Maybe that's useful for you?

    Here is the Changelog of the things not yet available in the asset store:

    v3.1.1 (fixes of today)
    * NEW: ExcludeByName and ExcludeByTag now work on canvases. Notice
    that this does not (yet) support hierarchical ignores. If you
    add a canvas to the exclude list then only the rect transforms
    within that canvas are ignored. Transforms in sub-canvases
    are still selectable.

    v3.1.0
    * FEATURE: ExcludeByTag added in addition to ExcludeByName.

    v3.0.1
    * FIX: ExcludeByName now also works if no 3D object has been found to select.


    Kind regards,
    Georg
     
  4. j_hansen

    j_hansen

    Joined:
    Oct 13, 2017
    Posts:
    3
    > I assume you want to have SmartUI always on and just turn it off with space in cases where you want to check if the native selection works better

    It's mostly because I have added quite a few things to my ignore list, and when I do need to select something ignore, I can just press space. Maybe it would be better to have a hotkey to "disabled ignore list", so that it's still possible to select ignored things.

    Since you provide the sources for the asset (which I'm really grateful for), I have just added the few changes myself, so no need to rush a asset store update on my account.
     
  5. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    66
    Thanks @j_hansen for the feedback.
    Now I see why you needed that.

    I have created a new version which adds the ability for a "ignore exclude lists" shortcut.
    I chose ESCAPE as the default key for that. I have also made all keyboard shortcuts configurable in the settings.

    Here is the changelog:

    v3.2.0
    * NEW: Now all key codes can be controlled in the settings (no
    more code editing necessary).
    * FEATURE: Press ESCAPE to disable the exclude lists (handy if
    you have very long exclude lists).


    I have sent you a download link for the newest version via PM (if you feel like testing it).

    Thank you,
    Georg
     
    Last edited: Oct 7, 2019
  6. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    66
    Something worth noting for all users about Smart UI Upgrades.

    If you want to keep your old settings (exclude lists for example) then you have to uncheck "SmartUiSelection Settings.asset" at import. If you want to make a backup of your settings, then copy the .asset file somewhere outside your project before import.

    Here is an image of what you need to do:
     
    Last edited: Oct 7, 2019