Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Make it possible to use the hierarchy search functionality in custom tools

Discussion in 'Editor Workflows' started by Xarbrough, Feb 1, 2020.

  1. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    I have a custom selection tool, which would benefit from using the search functionality provided by the scene hierarchy window. The tool displays a list of all GameObjects under the mouse cursor when right-clicking in the scene view. Now I'm working on adding a SearchField at the top of the popup list myself.

    However, I believe Unity has already written all the nice filtering logic such as ignoring whitespace, finding by type or sorting by hierarchy, etc. As a tools developers I would benefit from using this functionality, if it were exposed in one way or another.

    But most important of all, it would be ideal if I could trigger the gray-out effect in the scene view the same way the hierarchy window grays-out all objects that are not part of the filtered list.

    Edit: If anyone is trying to do the same thing, I'm currently using reflection to show the gray-out effect, but haven't tested for side-effects yet:
    Code (CSharp):
    1. var field = typeof(SceneView).GetField("m_SearchFilter", BindingFlags.NonPublic | BindingFlags.Instance);
    2. field.SetValue(SceneView.lastActiveSceneView, value);
     
    Last edited: Feb 1, 2020