What you see is what you select.
Skip the hierary search. Ignore empty ui elements and enjoy a predictable selection order. UI elements in front will always be selected first.
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.
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.
Full source code included
Super lightweight (less than 50 KByte)
Compatible with Unity 5.3.6f1+, 2017.x, 2018.x, 2019.x, 2020.x
It may work with earlier versions too but I haven't tested it.
Please notice that this is an EDITOR ONLY plugin.
It enhances the ui selection functionality in the SceneView of the Unity Editor.
It improves the selection by ignoring empty ui elements and allows for click-through selection of 3D objects behind the canvas. It avoids the (sometimes) unexpected order ofui selections done by the Editor.
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).
Versioning scheme: SemVer https://semver.org
Download the Asset and import it into your project.
You are done, no additional setup is needed.
If you are upgrading your installation and you want to keep your settings then please uncheck the "SmartUiSelection Settings.asset" at import.
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.
Info: the asset files will be copied into /Assets/Plugins/SmartUiSelection/Editor. The settings and manual files will be created in the same location.
Hint: There is a manual included, please read it (Tools > Smart Ui Selection > Manual).
If you find any errors then please use the support form, write to office[at]kamgam.com or contact me on Unity Connect
Please be patient, replies may take a few days. Please includeyour Asset Store Order Nr in your request.
Thank you.
* The Click-through detection does not analyse if a texture on a Graphic component has transparent pixels. At the moment only alpha values of colors, renderers or canvas groups are recognized.
* The "Enter Play Mode Options" Feature (Unity 2019.3+) has not yet been tested thoroughly. What is it? See here: https://blogs.unity3d.com/2019/11/05/enter-play-mode-faster-in-unity-2019-3/. Let me know if you have any issues using it.
Copyright KAMGAM e.U. - All rights reserved. The code can only be used under the standard Unity Asset Store End User License Agreement. A Copy of the EULA APPENDIX 1 is available at http://unity3d.com/company/legal/as_terms
I publish this plugin with full source code because as a developer I know how annoying it is to not have source code access. If youlike it then please remind others to purchase the plugin. Don't just copy and paste it everywhere.
Thank you
v3.4.0
* FIX: Fixed a crash if "Select 3D Objects Behind Canvas" was turned on. Thanks to Michael for reporting it.
* NEW: New option: "Select 3D Objects By Mesh". Since we now have to do the checking of 3d meshes by hand (due to the bugfix above) it may be slow in very big scenes. Turn it off if you have performance issues (enabled by default).
v3.3.0
* NEW: Unity 2020.x compatibility checked (all okay).
* FIX: Compability with other assets which use EditorScene GUI overlays (like ProBuilder).
* FIX: Fixed an error when working with canvases which do not have a CanvasScaler Component.
* NEW: New AutoHide option "Auto Hide Always" (hide canvases no matter where your cursor is).
* NEW: AutoHide now uses the new SceneVis features consistenlty instead of enabling/disabling objects in the hierarchy (less potential for side effects).
* NEW: AutoHide now automatically shows all auto-hidden canvases once the Build Settings are shown (works in Unity 2018.1+). This is done to avoid building with auto-hidden (disabled) canvases.
* NEW: Error messages will now print the stacktrace too (makes support easier).
* Change: Default auto hide distance threshold increased to 400 in the settings.
v3.2.1
* FIX: Smart Ui now works properly in UI Prefab Stage Environment scenes.
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).
v3.1.1
* 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.
v3.0.0
* NEW: High accuracy when selecting text objects. Now a bounding box
around the actual text is used instead of the rect transform.
Both TextMeshPro and Unity textfields are supported.
* NEW: High accuracy when selecting SpriteRenderer objects. The actual
mesh of the sprite renderers is used as hit target instead of
the bounding box. This can be controlled in the settings via the
"high precision sprite selection" option.
* FIX: 3D objects were missed by the click-through feature if no UI
element was in front as root (i.E. Prefabs).
* FIX: The new SceneVis feature (show/hide in scene view in 2019.1) is
now taken into account.
* FIX: "Exclude by name" now also works for 3D objects selected by the
click-through feature.
v2.1.1
* FIX: Objects whose hideFlags are set to HideFlags.NotEditable will
be ignored (can be configured by "Select Only Editable Objects").
v2.1.0
* FEATURE: Added "Push Key To Use Ui Selection" option to settings.
It's OFF by default but if turned on then then Smart Ui
Selection is only enabled if you press the SPACE key and click.
v2.0.5
* FIX: Layer state "locked" and "visible" are now taken into
account. Notice that the "visibility" of layers is
ignored on UI elements since Unity does not hide ui
elements on invisible layers, only 3d objects are affected.
v2.0.4
* FIX: Middle and right mouse button clicks are now ignored.
v2.0.3
* MINOR-FIX: Fixed the warning "CS0618: 'SceneView.onSceneGUIDelegate'
is obsolete ... " in Unity 2019.1+
v2.0.2
* FIX: Fixed a bug which caused SmartUiSelection to not register
clicks in PrefabMode / PrefabStage.
v2.0.1
* NEW: Unity 2019.x support (works with old plugin versions too).
* FIX: Fixed a bug which sometimes* caused the first element in the
hierarchy to be selected once a click occurred outside the SceneView.
This also fixes a bug which sometimes* caused a random ui element
to be shown once a click occurred outside the SceneView.
* sometimes ... It happened in Unity 2017.x, 2018.x, 2019.x, not 5.x
and only occurred if the same object has been clicked
multiple times in the SceneView before exiting it.
v2.0.0
* NEW: Introduced "autoHideDistanceThreshold" as replacement for
"autoHidePercentageThreshold" (is faster and works better).
* NEW: Auto-Hide Logic improved. It's now no longer in beta but
still disabled by default.
* FIX: Shift-Click deselect and Ctrl select support added.
* FIX: SmartUiSelection_Settings.excudeByName renamed to excludeByName.
v1.2.0
* FIX: Changes made to the settings via the Tools menu are now persisted across Unity reboots.
* FIX: If "smart ui selection" is turned on and nothing is found then we will just keep the original selection.
Example: If you click into an empty canvas area without a 3D object behind it, then we will now select the canvas just like the regular unity editor would (previously the selection remained empty).
* FIX: Elements in Canvases with a disabled Canvas Component are now ignored.
* FIX: Elements in Canvases with a disabled Graphics Component are now ignored.
* ENHANCEMENT: New options to turn "smart ui selection" and "click through cavans" (aka "select 3D Objects behind canvas") on or off.
* ENHANCEMENT: Shift-Click support for multiselect added.
* ENHANCEMENT: TextMeshPro SubMeshUI is now ignored. Instead the parent (aka TMPro.TextMeshProUGUI) is selected.
* ENHANCEMENT: #define KAMGAM_SMART_UI_SELECTION added to allow for easy plugin detection in foreign code (defined in EDITOR only!).
v1.1.0
* 3D selection now selects SpriteRenderers too (now selects any object with a Renderer component).
* 3D selection now cycles through results just like unity does.
* Improved robustness against errors. Selection will fall back to unity default on error.
v1.0.4
* fix in settings file to improve compatibility with other plugins
v1.0.3
* Initial public release (has been used internally for months)