askvity

How to Mass Apply Materials in Unity?

Published in Unity Materials 3 mins read

Applying the same material to multiple objects in Unity can be done efficiently using specific tools or scripts designed for this purpose. One method involves utilizing a script often referred to as "Mass Set Materials".

Using a "Mass Set Materials" Script

Based on the provided reference, a straightforward way to mass apply materials is through a script. This script automates the process after you've manually set the desired material on one object.

Steps for Mass Material Application

Here's how the method described in the reference works:

  1. Prepare the Target Object: Select one of the objects you want to change in your Unity scene. Manually change its material (or materials, if it has multiple slots) to the desired material(s) in the Inspector window. This object serves as the template for the others.
  2. Select Multiple Objects: While the object you just modified is still selected (and its properties are visible in the Inspector), hold down the Control key (or Command on macOS) and click on all the other objects in the scene that you want to apply the same material(s) to. Ensure the initially modified object remains selected along with the others.
  3. Execute the Script: With all target objects selected, navigate to the Scripts menu in the Unity editor's top bar. Click on Mass Set Materials.

According to the reference: "So to use it, just change the materials of one of the objects to whatever you want, the hold Control and select the other objects you want to change (the object you changed manually should still be shown in the inspector on the right), and click Scripts Mass Set Materials."

How it Works (Conceptual)

While the reference doesn't detail the script's internal workings, such scripts typically iterate through all the selected objects. For each selected object, they copy the material assignments from the first selected object (the one you manually changed) and apply them to the corresponding material slots on the other selected objects.

Benefits

  • Efficiency: Quickly applies materials to many objects without needing to drag and drop materials onto each one individually.
  • Consistency: Ensures multiple objects use the exact same material setup as the template object.

This script-based approach, as described in the reference, provides a direct and simple method for mass material assignment within the Unity editor.

Related Articles