Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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:
    1,365
    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:
    1,365
    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:
    1,365
    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:
    1,365
    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
  7. SIWWC

    SIWWC

    Joined:
    Oct 31, 2017
    Posts:
    13
    Hi, I found a isue, when I modify UI, I want to hide some sub UI element, but the plugin prevent it, I want, can the plugin only hide root canvas? so I can toggle sub element display. Thanks.
     
  8. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,365
    Hi,
    thanks for letting me know.
    Though I am not sure I completely understand the problem. The plugin shouldn't intervene with hiding stuff (unless the "auto hide feature" is turned on). Can you please send me your scene and a short description of what it does and what you expect it to do? First step in fixing is always reproducing the issue.
    If you don't want to post your files here in the public forum then please just send it to office@kamgam.com and I'll take a look.

    Alternatively you could also just record the issue and post the video (that would also help me find out what's happening).

    In the meantime can you please also verify it's smart-ui that's causing the issue. You can easily disable the plugin via the tool setting (enable/disable plugin). There is also a "Push Key to use UI Selection" feature. This would allow you to only activate smart ui if a certain key is pressed. That way you could selectively enable smart ui and keep it disabled while hiding your sub ui (just a workaround suggestion until the issue is resolved).
     
    Last edited: Dec 17, 2022
  9. SIWWC

    SIWWC

    Joined:
    Oct 31, 2017
    Posts:
    13
    Hi, thanks for your fast reply, I turned on the auto hide, after I found the issue, I turned off it, then I could hide sub UI element, so I can be sure that this is the plugin's reason.
     
  10. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,365
    Okay, thanks for checking :)

    So I guess you have a canvas and when you try to hide it the auto-hide feature turns it on again immediately? By "sub UI element" do you mean a canvas within another canvas or just a RectTransform child or one of the new UI Element UIs? I am asking this many questions because I am still struggling to understand/reproduce the issue.

    Could you please send me your scene or maybe post a screenshot of your hierarchy so I can investigate?
     
  11. SIWWC

    SIWWC

    Joined:
    Oct 31, 2017
    Posts:
    13
    I am sorry for my unclear expression, I mean that I can't hide any element in canvas as well as canvas itself when I turn on Auto Hide Canvas. I have just send you the test project.
     
    _geo__ likes this.
  12. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,365
    Thank you very much for the test project.
    I received it and can reproduce the issue.
    I'll get back to you (by email) as soon as I have a fix.
     
  13. SIWWC

    SIWWC

    Joined:
    Oct 31, 2017
    Posts:
    13
    Okay, that's good, thanks.
     
  14. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,365
    I have just sent a patch download link to your email and as a PM here in the forums. Please let me know if that fixes the issue. Once I have your confirmation I will also upload it to the AssetStore for all users.

    Patch Notes:
    * Fix for "Auto-Hide prohibiting users to hide sub-canvases" (thanks to SIWWC for reporting it)
    * Auto-Hide performance improvement (now the logic is only executed if a change is detected).
    * Finally removed some legacy code (Unity 2019.2 and below)


    Thank you for your patience.
     
    Last edited: Dec 17, 2022