How to change base material of material instances using Editor Utility

Hi,

I have a Static Mesh which has about ~15 materials, and I’d like to automate a task of copying those materials, changing their base material asset, and setting one of their parameters.

I got this thing right here:


And it works well. It copies the source material instances on the static mesh asset into its folder.

What I would like to do next is to change base material of all these material instances to a different one.

There is only a GetBaseMaterial function:
image

But I have no clue how to set it.

Is it possible to set base materials on material instance assets using the Editor Utility Blueprint. If not, is it possible to maybe spawn new Material Instance assets, copy the data from existing material instances into them, and set the base material that way?

Thanks in advace :slight_smile:

Aight boys, figured it out :slight_smile:

  1. You have to cast to MaterialInstanceConstant
  2. The magic word here is “SetMaterialInstanceParent”

:slight_smile:

2 Likes

Hey @Rawalanche!

I know the “Base Material” You’re looking for is the parameter called “Parent” if that helps! I’m sorry I’m not super versed in material instances. Try “Set Material Parent” or something like that! Here’s some documentation for material instances, see if that helps! :slight_smile:

Edit: Aw you beat me to it while I was getting the documentation link! Good for you! If you need any other help, let us know!

2 Likes