Unity3D Hierarchy Highlight Helper Script

This little snippet allows you to see which objects you are hovering over in the Unity3D hierarchy pane. It also shows which objects are being dragged.

Here’s the script. You will need to place this script into your Assets directory, inside the ‘Editor’ folder. If the ‘Editor’ folder does not exist, you need to create it.

How it works:

When the Unity3D editor loads, it calls the static constructor of this script. Then, the HighlighHelper hooks on to the scene view’s GUI callbacks, editor update callbacks, as well as the editor’s Hierarchy Pane’s item callbacks.

Whenever the Unity3D editor updates, the script checks whether the user is hovering over the hierarchy pane or not. If so, then it allows the window to get MouseMove callbacks. It’s hacky, but it works! Then, during the MouseMove events, the script checks if the mouse is inside the rectangle of the name label for any gameobject in the hierarchy, and if so, it notes down which object’s name is hovered over.

The scene view gui method then looks up if any gameobjects match that ‘instance ID’, and draws some circles around them. It does the same for dragged objects. I hope it helps! If you have any questions, please write it in the comments.

Update: I have just created a repository for the script here: https://github.com/toxicFork/Unity3D-HighlightHelper so it will be easier to track any changes or allow any pull requests.

4 thoughts on “Unity3D Hierarchy Highlight Helper Script

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.