Skip to main content

Asset Cleaner

The Asset Cleaner is a professional tool for identifying and safely removing unused SOAP assets from your project. It provides an advanced interface with smart detection, flexible selection options, and safe deletion workflows.

Overviewโ€‹

The Asset Cleaner scans your entire project to find SOAP assets (Variables and Events) that are not currently used in any scenes or prefabs. It then presents them in an organized, filterable list where you can selectively choose which assets to delete.

Opening the Asset Cleanerโ€‹

Via Menuโ€‹

  • Tools > SoapKit > Quick Actions > ๐Ÿงน Clean Unused Assets
  • Window > SoapKit > Asset Cleaner

Programmaticallyโ€‹

SOAPAssetCleanerWindow.ShowWindow();

Featuresโ€‹

Smart Detectionโ€‹

The Asset Cleaner uses intelligent scanning to identify truly unused assets:

  • Comprehensive Scan: Analyzes all ScriptableObjects in your project
  • SOAP Asset Filtering: Only considers actual SoapKit Variables and Events
  • Usage Analysis: Checks scenes, prefabs, and script references
  • Progress Tracking: Shows progress bar for large projects
  • Error Handling: Gracefully handles missing or corrupted assets

Advanced Selection Interfaceโ€‹

The tool provides flexible ways to select assets for deletion:

Tri-State Selectionโ€‹

  • Individual Checkboxes: Select specific assets
  • Select All: Master checkbox with three states:
    • โœ… Checked: All assets selected
    • โŒ Unchecked: No assets selected
    • โž– Mixed: Some assets selected

Selection Scope Optionsโ€‹

  • Apply to filtered only: Selection actions affect only visible/filtered assets
  • Apply to all: Selection actions affect all unused assets regardless of filter
  • Invert Selection: Flip the selection state of all assets in scope

Powerful Filtering & Sortingโ€‹

Find assets quickly with comprehensive filtering options:

Search Filterโ€‹

  • Real-time Search: Filter as you type
  • Multiple Fields: Search by asset name, type, or path
  • Clear Button: Quick filter reset with โœ– button

Sorting Optionsโ€‹

  • Sort By: Name, Type, or Path
  • Sort Order: Ascending (โ–ฒ) or Descending (โ–ผ)
  • Live Sorting: Results update immediately

Visual Asset Informationโ€‹

Each asset is displayed with comprehensive information:

  • Asset Icon: Unity's cached asset icons for easy identification
  • Asset Name: Click to select and ping asset in Project window
  • Type Display: Shows specific type (IntVariable, BoolGameEvent, etc.)
  • Full Path: Complete project path for precise location
  • Action Buttons:
    • ๐Ÿ“ Ping: Locate asset in Project window
    • ๐Ÿ”Ž Reveal: Show asset in Finder/Explorer

Safe Deletion Workflowโ€‹

The Asset Cleaner ensures safe deletion with multiple safeguards:

Double Confirmationโ€‹

  • First Dialog: Confirms deletion intent with preview
  • Asset Preview: Shows up to 7 assets, with "and X more" for larger selections
  • Clear Warning: States that deletion cannot be undone without version control

Batch Processingโ€‹

  • Progress Tracking: Shows deletion progress for large batches
  • Error Handling: Continues processing if individual deletions fail
  • Detailed Reporting: Reports success/failure counts with specific errors

Post-Deletion Actionsโ€‹

  • Automatic Refresh: Updates Asset Database after deletion
  • Result Dialog: Shows comprehensive results including any failures
  • Automatic Rescan: Refreshes unused asset list to show current state

User Interfaceโ€‹

Header Sectionโ€‹

  • Title: "SOAP Asset Cleaner"
  • Scan Button: ๐Ÿ”„ Manual rescan for unused assets
  • Filter Controls: Search field with clear button
  • Sort Controls: Dropdown and order toggle
  • Selection Controls: Scope toggle, Select All, Invert Selection
  • Summary: Shows total assets and selection count

Asset Listโ€‹

  • Scrollable View: Handles large asset lists efficiently
  • Boxed Items: Clear visual separation between assets
  • Interactive Elements: Clickable names, hover tooltips
  • Status Indicators: Visual feedback for selection state
  • Delete Button: ๐Ÿ—‘๏ธ Prominent deletion button with count
  • Visual Styling: Red text to indicate destructive action
  • Disabled State: Grayed out when no assets selected
  • Close Button: โŒ Safe exit without changes
  • Warning Message: Persistent reminder about version control

Best Practicesโ€‹

Before Usingโ€‹

  1. Version Control: Ensure your project is committed to version control
  2. Backup: Consider creating a project backup for safety
  3. Team Communication: Notify team members before major cleanups

During Usageโ€‹

  1. Review Carefully: Examine asset names and paths before deletion
  2. Use Filters: Narrow down to specific asset types or locations
  3. Small Batches: Delete in smaller groups rather than all at once
  4. Test Scenes: Verify critical scenes still work after cleanup

After Cleanupโ€‹

  1. Test Build: Ensure project still builds successfully
  2. Run Tests: Execute any automated tests you have
  3. Scene Validation: Check that important scenes load correctly
  4. Performance Check: Verify no performance regressions

Common Use Casesโ€‹

Project Maintenanceโ€‹

  • Regular Cleanup: Monthly or quarterly unused asset removal
  • Pre-Release: Clean up before major releases or submissions
  • Team Handoffs: Prepare clean project state for new team members

Development Workflowsโ€‹

  • Prototype Cleanup: Remove experimental assets after prototyping
  • Feature Removal: Clean up assets from removed features
  • Refactoring: Remove assets replaced during architecture changes

Project Analysisโ€‹

  • Asset Inventory: Review what SOAP assets exist in your project
  • Usage Patterns: Understand which assets are actively used
  • Storage Optimization: Reduce project size by removing dead assets

Troubleshootingโ€‹

Common Issuesโ€‹

Assets Marked as Used But Seem Unused

  • Check prefabs in Resources folders
  • Verify assets aren't referenced in code via Resources.Load
  • Look for indirect references through other ScriptableObjects

Deletion Fails for Some Assets

  • Ensure assets aren't in use during deletion
  • Check file permissions and locks
  • Verify assets aren't imported as part of packages

Performance Issues with Large Projects

  • Use filters to reduce visible asset count
  • Process deletions in smaller batches
  • Consider closing other Unity windows during scanning

Recoveryโ€‹

If assets are accidentally deleted:

  1. Version Control: Restore from your version control system
  2. Unity Cache: Check Unity's asset server cache if applicable
  3. Backups: Restore from project backups
  4. Recreation: Recreate assets using Asset Creator if necessary

See Alsoโ€‹