Skip to content

Xenoforge/smartsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

Smart Search for Unity

Smart Search Banner

Advanced hierarchy search and filtering tool for Unity Editor

Smart Search enhances Unity's built-in hierarchy search with powerful filtering options, logical operators, and preset management.


πŸ“¦ Installation

  1. The SmartSearch folder should be in Assets/SmartSearch/ in your Unity project
  2. Unity will automatically compile the scripts
  3. Open via Tools > Smart Search or press Ctrl+H

πŸš€ Quick Start

Basic Search

  1. Open Smart Search - Tools > Smart Search or Ctrl+H
  2. Select filter type - Choose from dropdown (Name, Tag, Layer, etc.)
  3. Enter value - Type or select from available options
  4. Click SEARCH - View results below

Example Searches

Find all enemies with Rigidbody

  1. Filter By: Component
  2. Component: Type "rigidbody" β†’ Select Rigidbody
  3. Click + Add Condition
  4. Operator: And
  5. Filter By: Tag
  6. Tag: Enemy
  7. Click SEARCH

Find inactive static objects

  1. Filter By: Static
  2. Is Static: βœ“ True
  3. Click + Add Condition
  4. Operator: And
  5. Filter By: Active
  6. Is Active: βœ— False
  7. Click SEARCH

Find players with health > 50

  1. Filter By: Component
  2. Component: Type "player" β†’ Select Player
  3. Filter by Field: βœ“ True
  4. Field: health (from dropdown)
  5. Comparison: Greater
  6. Value: 50
  7. Click SEARCH

πŸ”§ Filter Types

Name

Search by GameObject name (contains match)

  • Example: "Enemy" finds "Enemy_01", "EnemySpawner", etc.

Tag

Exact tag match from project tags

  • Select from dropdown of existing tags

Layer

Exact layer match from project layers

  • Select from dropdown of existing layers

Component

Search for GameObjects with specific component

  • Basic: Check if component exists
  • Advanced: Filter by public field/property values

Component Field Filtering:

  • Toggle "Filter by Field"
  • Select field from dropdown (auto-populated with public fields)
  • Choose comparison operator (=, !=, >, <, >=, <=)
  • Enter value to compare

Static

Filter by static flag

  • True: Only static objects
  • False: Only non-static objects

Active

Filter by active state

  • True: Only active objects (activeSelf)
  • False: Only inactive objects

🎨 Working with Results

Select All

Selects all found objects in the hierarchy. Use this to:

  • Batch edit properties
  • Group objects
  • Copy/duplicate multiple objects

Select Inverse

Selects everything EXCEPT the search results. Useful for:

  • Isolating search results by deleting everything else (in test scenes)
  • Batch operations on "everything but X"

Highlight

Applies blue background highlighting to results in hierarchy. Highlights persist until cleared. Good for:

  • Visual reference while working
  • Keeping track of specific objects
  • Non-intrusive result marking

Filter View

Hides all non-matching objects in hierarchy (uses HideFlags). Perfect for:

  • Working in complex scenes
  • Focusing on specific object types
  • Reducing visual clutter

Important: Filter View modifies HideFlags.HideInHierarchy temporarily. Always use Clear when done to restore normal hierarchy visibility!

Clear

Removes all highlights and filters, restoring hierarchy to normal state.


πŸ’Ύ Preset System

Creating Presets

Save Current Search:

  1. Build your search with filters
  2. Click Save Preset button
  3. Choose location and enter name
  4. Preset is saved as ScriptableObject asset in Assets/SmartSearch/Resources/SearchPresets/

Update Existing Preset:

  1. Select preset from dropdown at top
  2. Modify filters as needed
  3. Click Save Preset (updates current preset)

Using Presets

Load to Editor:

  1. Select preset from dropdown at top
  2. Click Load button
  3. Filters populate in builder
  4. Modify and search as needed

Apply Directly:

  1. Find preset in bottom list
  2. Click Apply Filter button
  3. Filter View is applied immediately without needing to click Search

Delete Preset:

  1. Select preset from dropdown
  2. Click Delete button
  3. Confirm deletion

⌨️ Keyboard Shortcuts

  • Ctrl+H - Open Smart Search window
  • ESC - Clear search field focus

πŸ“‹ Context Menu

Right-click any GameObject in hierarchy:

  • Smart Search > Clear Filter - Remove active filter view
  • Smart Search > Open Smart Search Window - Quick window access

πŸ” Advanced Usage

Combining Multiple Conditions

Build complex queries with logical operators:

Example:

Component: Rigidbody
AND Tag: Enemy
AND NOT Layer: Ignore

This finds all enemies with Rigidbody that are NOT on Ignore layer.

Component Field Search

Search for specific component values:

Example:

Component: Player
Filter by Field: βœ“
Field: health
Comparison: >
Value: 50

Finds all Player components where health is greater than 50.

Supported Value Types:

  • Int, Float - All comparison operators
  • Bool - Equal/Not Equal only
  • String - Equal/Not Equal only

Quick Workflow

  1. Build common searches once
  2. Save as presets
  3. Use Apply Filter for instant filtering
  4. Clear filter when done
  5. Repeat with different presets as needed

Tip: Press Ctrl+H anytime for instant access!


πŸ› Troubleshooting

Window doesn't open

  • Check Console for errors
  • Ensure scripts are in Assets/SmartSearch/Editor/ folder
  • Try reimporting the package

Component search not working

  • Make sure component name is spelled correctly
  • Use the dropdown auto-complete feature
  • Component must inherit from UnityEngine.Component

Filter View not clearing

  • Use Clear button in Smart Search window
  • Or use context menu: GameObject > Smart Search > Clear Filter
  • If HideFlags persist (rare), restart Unity

Preset not saving

  • Ensure Assets/SmartSearch/Resources/SearchPresets/ folder exists
  • Check folder write permissions
  • Unity will create folders automatically if missing

Component fields not showing

  • Only public fields and properties are shown
  • Field must be instance member (not static)
  • Refresh by reselecting the component

πŸ’‘ Best Practices

Organization

  • Name presets clearly - Use descriptive names like "All_Enemies_With_AI"
  • Use prefixes - Organize presets by category (ENV_, CHAR_, SYS_)
  • Clean up regularly - Delete unused presets to keep list manageable

Usage

  • Clear filters regularly - Don't leave Filter View active when not needed
  • Use highlights for reference - Highlights are less intrusive than filters
  • Save common searches - Build a preset library for your project
  • Combine with Unity tools - Use alongside Scene view filters and gizmos

Performance

  • Filter View works efficiently even with 1000+ objects
  • Component field search may be slower on very large scenes
  • Use specific filters to narrow results quickly

πŸŽ“ Use Case Examples

Level Design

  • Find all trigger colliders: Component: BoxCollider + Tag: Trigger
  • Lights on specific layer: Component: Light + Layer: Environment
  • Disabled spawn points: Tag: SpawnPoint + Active: False

Debugging

  • Inactive objects: Active: False
  • Static objects by mistake: Static: True + Tag: Dynamic
  • Objects with low health: Component: Health + Field: currentHealth < 30

Optimization

  • All rigidbodies: Component: Rigidbody
  • Heavy renderers: Component: MeshRenderer + Layer: Environment
  • Find and batch process: Search β†’ Select All β†’ Batch Edit

Cleanup

  • Unnamed objects: Name: GameObject
  • Untagged objects: Tag: Untagged
  • Test objects: Name: Test β†’ Select All β†’ Delete
  • Debug objects: Name: Debug OR Name: Temp

πŸ“ File Structure

SmartSearch/
β”œβ”€β”€ Editor/
β”‚   β”œβ”€β”€ SmartSearchWindow.cs         - Main editor window
β”‚   β”œβ”€β”€ SearchEngine.cs              - Search logic & query parser
β”‚   β”œβ”€β”€ SearchQuery.cs               - Query data structures
β”‚   β”œβ”€β”€ SearchPreset.cs              - Preset ScriptableObject
β”‚   β”œβ”€β”€ HierarchyHighlighter.cs      - Hierarchy highlighting
β”‚   β”œβ”€β”€ HierarchyFilterView.cs       - Filter view system
β”‚   └── ContextMenuExtension.cs      - Context menu integration
└── Resources/
    └── SearchPresets/               - Saved presets location

πŸ”§ Technical Details

Requirements

  • Unity Version: 2020.3 or higher
  • Platform: Editor only (no runtime components)
  • Dependencies: None

How It Works

Search Engine:

  • Scans all GameObjects in scene using Object.FindObjectsByType<GameObject>
  • Evaluates each object against filter conditions
  • Uses reflection for component field access
  • Returns list of matching objects

Highlight System:

  • Uses EditorApplication.hierarchyWindowItemOnGUI callback
  • Draws colored rect behind matching items
  • Stores instance IDs in HashSet for fast lookup

Filter View:

  • Temporarily sets HideFlags.HideInHierarchy on non-matching objects
  • Automatically refreshes on hierarchy changes
  • Clears all flags when disabled

Presets:

  • Stored as ScriptableObject assets
  • Contains query string representation
  • Can be shared across team via version control

πŸ’‘ Tips & Tricks

  • Quick access - Ctrl+H from anywhere in Unity
  • Double-click results - Quickly ping objects in hierarchy
  • Chain searches - Search β†’ Filter View β†’ New Search on filtered results
  • Preset organization - Use prefixes in preset names (e.g., "ENV_", "CHAR_")
  • Hotkey workflow - Ctrl+H β†’ Build filters β†’ Search β†’ Apply action β†’ Clear
  • Component discovery - Type a few letters in Component search to explore available components
  • Save before Filter View - Always save scene before using Filter View extensively
  • Backup presets - Presets are assets, include them in version control

πŸ“ Known Limitations

  • Component field search only works with public fields/properties
  • Filter View uses HideFlags (doesn't work like Unity's native search field)
  • Maximum of ~50 filters per query recommended (performance)
  • Complex component hierarchies may need multiple searches
  • Prefab overrides are not considered in searches

πŸ”„ Version History

v1.0.0

  • Initial release
  • Visual query builder
  • 6 filter types (Name, Tag, Layer, Component, Static, Active)
  • Component field value filtering
  • Logical operators (AND, OR, NOT)
  • 4 result actions (Select All, Select Inverse, Highlight, Filter View)
  • Preset system
  • Context menu integration
  • Keyboard shortcuts

πŸ“§ Support

If you encounter issues:

  1. Check Console for error messages
  2. Verify all files are in correct folders
  3. Try reimporting the package
  4. Restart Unity if problems persist

For feature requests or bug reports, please contact support.


Happy Searching! πŸ”

About

Documentation and support files for Smart Search Unity Assets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published