# ‘Set Material’ fails when using in Dataprep

**URL:** <https://forums.unrealengine.com/t/set-material-fails-when-using-in-dataprep/722509>\
**Category:** Pipeline & Plugins\
**Tags:** Datasmith, Dataprep, unreal-engine, Blueprint, question\
**Created:** [December 6, 2022, 10:38am UTC](https://forums.unrealengine.com/t/set-material-fails-when-using-in-dataprep/722509 "2022-12-06T10:38:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimPotratz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimPotratz](https://forums.unrealengine.com/u/TimPotratz)\
**Post date:** [December 6, 2022, 10:38am UTC](https://forums.unrealengine.com/t/set-material-fails-when-using-in-dataprep/722509/1 "2022-12-06T10:38:13Z")

</div>

Hello all,  
I have been tinkering around with materials in Dataprep for some time now and noticed a problem.  
In this example I want to find similar materials and combine the once that are nearly identical in order to improve on performance (and yes I know ‘Locality-Sensitive-Hashing’ exists, but I’m a bit lazy setting it up):

 ![MyCode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/b/f3b2f23ec78adce321a08393cf1b19c449fbbf62.png)

The code seems to work fine in finding the similar materials of the imported data. It also deletes the now unassacary materials, though the replacement materials don’t get set by the ‘Set Material’ function for some reason.

Am I missing something, or is this just a bug?  
If you have other ideas, please let me know.

---

<div class="post-metadata">

**Author:** ![UE\_FlavienP](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ue_flavienp/32/1194546_2.png) [@UE\_FlavienP](https://forums.unrealengine.com/u/UE_FlavienP)\
**Post date:** [December 6, 2022, 10:57am UTC](https://forums.unrealengine.com/t/set-material-fails-when-using-in-dataprep/722509/2 "2022-12-06T10:57:05Z")

</div>

You cannot get static mesh components directly: in the dataprep context you have assets or actors but no components.  
You should get all actors, then all static mesh components from actors

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/f/40f352a9cba7d2f88a54a981a677e89b91420e79.png)

---

<div class="post-metadata">

**Author:** ![TimPotratz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimPotratz](https://forums.unrealengine.com/u/TimPotratz)\
**Post date:** [December 6, 2022, 1:23pm UTC](https://forums.unrealengine.com/t/set-material-fails-when-using-in-dataprep/722509/3 "2022-12-06T13:23:48Z")

</div>

Still doesn’t set the new material.
