In this lesson, you will learn how to efficiently update every instance of a prefab across your entire project by modifying the original asset.
Up until now, we have used modular prefabs to build our complex physics puzzles, like trap-filled corridors or multi-stage lever systems. When you place a prefab in a scene, Unity creates an instance. Sometimes, you might discover that a specific component—perhaps the Spring Joint on a door handle—needs a slight adjustment. Instead of manually editing every single door in every scene, we use the power of the Prefab Asset to propagate those changes.
The Workflow of Propagation
To propagate a change, you must edit the source asset, not just the instance in your scene. You can do this in two ways:
- Opening the Prefab Asset: Double-click the prefab file in your Project window. This opens the Prefab Mode. Any change you make here (like adjusting a
Rigidbodymass or adding a new script) is automatically saved to the asset file. - Applying from an Instance: If you are already working in a scene and modify an instance, you will notice the Overrides dropdown in the Inspector. If you click it, you can select Apply All. This pushes your local scene changes back into the original Prefab Asset.
Why This Matters for Physics
Imagine you have twenty "Destructible Wall" prefabs scattered across your game. If you realize the physics constraints are too loose and the walls collapse too easily, you don't need to hunt down each wall. By opening one instance, tweaking the Fixed Joint settings, and clicking Apply All, Unity immediately updates the underlying asset. Every scene in your project that references this prefab will instantly reflect the new physics settings the next time the scene loads.
Think of the Prefab Asset as the "blueprint" and the scenes as the "construction site." If you update the blueprint, the site updates automatically. This ensures your physics behavior remains consistent across your entire mechanical environment without the risk of human error or manual inconsistencies.
Key Takeaway: By modifying the source Prefab Asset and applying your overrides, you ensure that physics adjustments are synchronized globally across your entire project with a single click.