# Set Material Slot Names in Blueprint

**URL:** <https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE5-0, Widget, question, Blueprint\
**Created:** [September 5, 2022, 2:10pm UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936 "2022-09-05T14:10:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoosten](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yoosten/32/548255_2.png) [@Yoosten](https://forums.unrealengine.com/u/Yoosten)\
**Post date:** [September 5, 2022, 2:10pm UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/1 "2022-09-05T14:10:42Z")

</div>

Question is as simple as it gets.  
I know I can go inside of a static mesh to find its material slots and rename them. But I wanna do it procedurally via blueprint. There is “Get Material Slot Names” but not SET Material Slot Names.  
I basically wanna mass assign random materials based on the material they are suppsed to replace, and for the first time doing that, I can theoretically just look for the name of the material that I wanna replace. But once that’s done, I can’t use that method a second time.  
I tried playing around with tags, but that’s also flawed for this cause.

The easiest way would be to just go by Material Slot Names, but for some reason I can’t rename those in Blueprint. Or can I? Any Ideas?

Thanks in Advance!

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [September 6, 2022, 3:27am UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/2 "2022-09-06T03:27:06Z")

</div>

Hey there @Yoosten! Would you be attempting to replace these names at runtime? As I don’t believe that variable is exposed to be changed at runtime at all. I’ve seen a couple of users that created editor blueprints to be able to modify them. I’ll leave a thread with a bit of information on that at least. Hope this helps!

> [@Setting Material Slot Names on Static Mesh Materials not updating Editor UI](https://forums.unrealengine.com/t/setting-material-slot-names-on-static-mesh-materials-not-updating-editor-ui/559681):
>
> I’m trying to rename the material slots on the selected static meshes in the content browser. If I run the script below it works if I get the editor property and print it to log after settings it, but it doesn’t update the “Slot Name” field in the editor for the material on the selected static meshes. The documentation says that using “set\_editor\_property” will force the editor UI update but it’s not in this case. Any idea’s what I’m doing wrong? selectedAssetsPaths = unreal.EditorUtilityLi…

---

<div class="post-metadata">

**Author:** ![Yoosten](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yoosten/32/548255_2.png) [@Yoosten](https://forums.unrealengine.com/u/Yoosten)\
**Post date:** [September 6, 2022, 8:11am UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/3 "2022-09-06T08:11:12Z")

</div>

Hello there!  
No, I’m trying to set them via Editor Utility Widget. The Thread you linked is sadly for Python Users, and I can’t find an option to create said copy in Blueprint.  
Any idea how I can handle this in Blueprint and in the editor?

---

<div class="post-metadata">

**Author:** ![Yoosten](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yoosten/32/548255_2.png) [@Yoosten](https://forums.unrealengine.com/u/Yoosten)\
**Post date:** [September 6, 2022, 11:05am UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/4 "2022-09-06T11:05:12Z")

</div>

Aight, I found my solution:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/7/4279f3b9cb53ef462d0f86e3270f15a038004af2.png) ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/f/94fbc5d0bf14b9e6918a1094707bcc5e08e79c1c.png)  
This won’t work for people that additionally put default tags on their Meshes, but I just check if the selected Actor has Tags. If it doesn’t, I add its Default Materials as Tags to it. If it already has Tags, I check if any of them match the Material Name I’m specifying. If any do, I can just take the Tag Index (which matches the Material Index) and replace the Material in said Index.

that said, I just noticed that this won’t work in Cases where 2 Slots contain the same Material. I’ll quickly fix that, but that’ll be simple enough so that I won’t update this post anymore.  
I hope this helped anyone who wanted to do similar things :\>

---

<div class="post-metadata">

**Author:** ![Yoosten](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yoosten/32/548255_2.png) [@Yoosten](https://forums.unrealengine.com/u/Yoosten)\
**Post date:** [September 6, 2022, 11:12am UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/5 "2022-09-06T11:12:36Z")

</div>

Apparently I’m not a Man of my Word.  
Here’s the updated portion of the Graph:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/a/65aea3d6c192ad13e525603f507afe46aeb1646a.png)

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [September 7, 2022, 1:03am UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/6 "2022-09-07T01:03:06Z")

</div>

Oh wow fantastic! I was trying to work up a C++ set up for you but it seems you got it in BP no less! Amazing. Do you mind if I reference this setup for a possible Community Snippet in the future? One question that absolutely stumped me for a moment.

---

<div class="post-metadata">

**Author:** ![TristonS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TristonS](https://forums.unrealengine.com/u/TristonS)\
**Post date:** [April 2, 2023, 1:41am UTC](https://forums.unrealengine.com/t/set-material-slot-names-in-blueprint/641936/7 "2023-04-02T01:41:43Z")

</div>

Creative solution, it’s a shame we can’t directly set the material slot names though, would be super helpful to do this in batches.

EDIT: So it turns out it is possible. I was editing using the bulk property matrix, and found the structure containing the data. Here’s what the code looks like:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/0/2a04c5c6351813fc96ec673f8246ff75c2d00a04.png)

Ignore the spaghetti, works as intended though. This is for skeletal meshes, but I imagine there’s a similar property for static.
