Swap thousands of assets without freezing the Editor. A high-performance tool for replacing Scene Objects, Materials, and Terrain details. Includes weighted randomization and advanced filtering.The Tool: The core Scene Object Replacer utility is strictly Editor code. It is fully compatible with all render pipelines (Built-in, URP, and HDRP).The Demo Scene: The optional demo environment included in the package is configured for URP.A High-Performance "Find and Replace" for Unity ScenesScene Object Replacer is a standalone, free utility designed to handle mass editing in Unity. Powered by the Unity Job System and Burst Compiler, it runs complex filtering and replacement logic on worker threads, ensuring the Editor remains responsive even when processing tens of thousands of objects.The Origin StoryI originally developed this tool as the internal deployment utility for BurstLOD, a paid optimization suite I released a few months ago. I needed a way to quickly swap "greybox" placeholder assets for final art, and to populate large terrains without manually painting thousands of trees.While it is included in the paid suite, I am releasing it now as a standalone free asset because basic workflow utilities shouldn't always be paywalled. I made this to solve my own level design bottlenecks, and I’m sharing it in hopes it saves you time too.Core FeaturesThis is not a simple DestroyImmediate / Instantiate loop. It is a robust tool with deep filtering and placement logic.Replace Anything: Swap Scene GameObjects, Prefabs, or Materials.Deep Filtering: Don't just find by name. Filter targets by Tag, Layer, or Component. You can even drag a specific C# script asset into the filter list to target only objects containing that specific logic.Weighted Random Pools: Replace a single source object with a probabilistic mix of new assets (e.g., "Replace Cube with 60% Rock_A, 20% Rock_B, and 20% Rock_C").Advanced Spatial Control:Spatial Volumes: Restrict operations to a Box, Sphere, or Cylinder volume.Binned Weighting: Modulate spawn probabilities based on position. For example, configure Snow_Tree to only spawn in the "High" altitude bin, and Swamp_Tree to only spawn in the "Low" altitude bin.Proximity & Density: A Burst-compiled $N^2$ pre-pass that analyzes object density. It can automatically cull objects that are too close (clipping) or remove isolated objects that are too far from neighbors.Terrain Support: Fully supports Terrain Trees and Terrain Details (grass).Note: For Details, it supports probabilistic replacement on terrains using "Instance Count" mode. For legacy "Coverage" mode terrains, it performs high-speed layer swapping.Safety First: Includes a "Dry Run" analysis mode that generates a detailed report of what will be changed before you commit. All operations are fully registered with Unity's Undo system.Real-World Use CasesThe tool is built to solve specific, repetitive problems commonly faced during level design:Greybox to Final Art: Instantly replace hundreds of placeholder cubes or capsules with final art prefabs, automatically applying random rotation and scale variation to break up repetition.Biome Management: Selectively replace vegetation on a terrain within a specific radius. For example, replace all "Oak Trees" with "Swamp Trees" only within a specific low-altitude area of your map.Material Overhauls: Swiftly swap a deprecated material for a new one across every MeshRenderer in the scene, regardless of the object hierarchy.Procedural Cleanup: If you use procedural spawners that create cluttered results, use this tool to "thin out" dense clusters without deleting everything and starting over.Precision & ControlReplacing objects blindly can ruin a scene. This tool includes advanced filtering and placement logic to give you granular control over what gets changed and where.Spatial Filtering: Restrict operations to a specific 3D volume (Box or Cylinder) or a specific altitude range (Min/Max Y). This allows you to target specific areas—like a town square or a mountain peak—without affecting the rest of the world.Binned Weighting: A more advanced feature for naturalistic placement. You can adjust replacement probabilities based on location. For example, configure the tool to spawn "Snowy Rocks" at high altitudes and "Mossy Rocks" at low altitudes within the same operation.Proximity & Density Control: Includes a "Pre-Process" filter that analyzes object density. It can automatically remove objects that are too close to each other (preventing clipping) or remove isolated objects that are floating too far from their neighbors.Smart Placement: When replacing objects, the tool can raycast downward to snap new instances to the ground and align them to the surface normal, ensuring your new props sit correctly on the terrain or floor geometry.Safety & WorkflowMass-editing a scene can be risky, so the tool is designed with safety rails to prevent accidents.Analyze (Dry Run): Before committing to any changes, you can run an analysis. This generates a detailed report showing exactly how many objects were found, which filters they matched, and what will be replaced.Presets: Save your complex configurations (source lists, destination weights, filters) as ScriptableObject presets. This allows you to share setups with your team or reuse specific replacement logic (e.g., "Forest Thinner") across different scenes.Non-Blocking: Because it utilizes the Job System, the tool processes data asynchronously. This prevents the Editor from hanging or crashing when calculating filters for scenes with tens of thousands of objects.Open Development & ExpectationsThis asset is intentionally niche. I built it to solve specific bottlenecks in my own development process, and while I have polished it for public release, it may not fit every single edge case in every project.Feedback: If you find a bug or have an idea for a feature that would improve your workflow, please let me know. I am active in maintaining my tools and value user input.Support: The package includes comprehensive documentation covering every setting and workflow.It's Free: I am releasing this because I believe in sharing useful tools with the community. If it saves you a few hours of manual work, then it has done its job.The Veridian EcosystemThe Scene Object Replacer is part of a larger optimization pipeline. While this tool helps you populate your scenes with high-detail assets, you will eventually need to optimize those assets to keep your frame rate high.If you find this tool useful, I encourage you to check out my primary optimization suite:[BurstLOD: Burst-Powered Optimization Suite]Once you have replaced your greybox cubes with thousands of high-quality models, BurstLOD allows you to generate LODs, fuse meshes, and optimize geometry directly in the editor without slowing down your workflow.Automatic LOD Generation: Create LOD chains for entire folders of assets in the background.Mesh Fusion: Combine multi-part objects to reduce draw calls.Interactive Sculpting: Fix mesh issues manually within Unity.Please check out my publisher page to see BurstLOD and other optimization tools designed to respect your time and performance budget.DocumentationScene Object Replacer (Companion Tool): https://docs.google.com/document/d/17nEy12v5nKBteGeaMf7HBRJQbVZTg1iOVrQPSPJiQb8/edit?usp=sharingBurstLOD (Core System & Runtime API): https://docs.google.com/document/d/1Sk9thBSGfofy9_fclAIcv66rbWjJ4WfckWfhqC3beGU/edit?usp=sharing1. Architecture & PerformanceThe Scene Object Replacer is built on a Gather-Process-Apply architecture designed to keep the Unity Editor responsive even when manipulating tens of thousands of objects. By decoupling data gathering from processing, the heavy lifting is offloaded to worker threads.Gather (Main Thread): The tool quickly scans the scene hierarchy or terrain data using standard Unity APIs (e.g., PrefabUtility, TerrainData.GetDetailLayer). This data is immediately converted into unmanaged NativeArray structures.Process (Worker Threads): The core logic is executed by Burst-compiled C# Jobs.SceneObjectFilterJob: Runs parallel filtering for scene objects based on Prefab IDs, Tags, Layers, and spatial bounds.TerrainTreeProcessingJob: Handles tree instances, applying spatial masks and probabilistic replacement rules in parallel batches.TerrainDetailInstanceReplacementJob: A specialized job that redistributes grass/detail instances for "Instance Count" terrains using a probabilistic density check.Apply (Main Thread): Once the jobs complete, the main thread applies the changes in a single batch (e.g., TerrainData.SetTreeInstances or bulk instantiation) and registers a single Undo entry.2. Dependencies & RequirementsThis tool is a pure Editor Utility contained entirely within its own assembly (Veridian.Perspective.SceneMutator.Editor). It is stripped from builds automatically.Unity Version: Requires Unity 6 (6000.0) or higher.Standard Packages: The tool utilizes com.unity.burst, com.unity.collections, and com.unity.mathematics. These are standard dependencies in modern Unity projects (especially URP) and require no manual installation.Safety: The asset contains NO unsafe code blocks. It relies entirely on safe, verified Burst-compatible C# structures (NativeArray, IJobParallelFor).3. Advanced Logic & AlgorithmsThe tool employs several algorithmic safeguards and specialized techniques to ensure stability and naturalistic results.Proximity Filtering (N^2 Check)To prevent object clipping or remove floating artifacts, the tool includes a proximity pre-pass.Algorithm: Uses a brute-force N^2 distance check optimized via Burst. It identifies objects violating MinDistance (clipping) or MaxDistance (isolation).Tie-Breaking: When removing objects in a dense cluster, it deterministically prioritizes keeping the object with the lower InstanceID to ensure consistent results across multiple runs.Safety Limits: To prevent editor freezes on massive datasets, the filter includes a Warning Threshold (10k objects) and a Hard Limit (50k objects), automatically skipping this step if the dataset is too large.Binned Weighting SystemFor naturalistic distribution, the tool divides the spatial volume into a 9-bin voxel matrix relative to the filter's center.Structure:Height (Y): Low / Mid / HighDistance (XZ): Close / Mid / FarInterpolation: The system pre-calculates weights for all 9 sub-bins based on your MiddleMin and MiddleMax settings, allowing for complex rules like "Spawn mostly in the center-low, but never in the far-high."Terrain Detail HandlingThe tool adapts its technique based on your Terrain's specific rendering mode:Instance Count Mode (DrawInstanced = True): The tool treats grass as individual instances. It runs the TerrainDetailInstanceReplacementJob to probabilistically remove or replace specific strands of grass while respecting spatial filters.Coverage Mode (DrawInstanced = False): Since Unity does not track individual instances in this legacy mode, the tool performs a high-speed Density Map Swap. It merges the source density map additively into the destination map and clears the source, ignoring probability settings.4. Data Persistence & WorkflowThe tool is designed to integrate natively with the Unity Editor ecosystem, treating your configuration data and actions as standard assets and operations.ScriptableObject Presets: All settings—including complex filter rules and weighted pools—are serialized into SceneObjectReplacerPreset assets (ScriptableObject). This allows you to version control your replacement logic, share configurations between team members, or reuse specific "recipes" (e.g., "Forest Thinner") across different scenes.Native Undo Support: The tool wraps complex batch operations into a single Undo group. Whether you replace 500 prefab instances or update a Terrain Detail layer, a single Ctrl+Z cleanly reverts the entire operation using Unity's Undo API.Scene View Visualization: Uses OnSceneGUI to draw performant wireframe gizmos for spatial filters. It creates temporary, non-saving primitives to visualize height planes, ensuring what you see matches exactly what the Burst jobs will process.5. Supported TypesThe replacement engine supports a wide range of Unity object types, handling the specific API requirements for each:Scene Prefabs: Fully supports Prefab variants and nested Prefabs. It uses PrefabUtility to instantiate replacements, ensuring the new objects maintain their link to the original asset (they are not just loose geometry).Static & Dynamic GameObjects: Works on any GameObject in the hierarchy, regardless of static flags.Terrain Trees: Direct manipulation of TerrainData.treeInstances.Terrain Details: Supports both Vertex Lit (Mesh) and Grass (Texture) detail prototypes.Materials: targets Renderer.sharedMaterials to swap material references without modifying the mesh assets themselves."Several prefab assets within the included demo scene were generated using AI tools. This demo scene is entirely optional for testing purposes and can be safely deleted without affecting the core functionality of the editor window."




