# How to correctly set material for an instanced static mesh?

**URL:** <https://forums.unrealengine.com/t/how-to-correctly-set-material-for-an-instanced-static-mesh/632477>\
**Category:** C++\
**Tags:** unreal-engine, CPP, UE4-27\
**Created:** [August 22, 2022, 8:08pm UTC](https://forums.unrealengine.com/t/how-to-correctly-set-material-for-an-instanced-static-mesh/632477 "2022-08-22T20:08:33Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 23, 2022, 6:29pm UTC](https://forums.unrealengine.com/t/how-to-correctly-set-material-for-an-instanced-static-mesh/632477/7 "2022-08-23T18:29:14Z")

</div>

So I recived help on this long ago, did most of it alone, but the last part I wasn’t setting the parameter. Maybe it’s this maybe it’s something else.

Anyway enjoy oldies, oldies but goldies.

> [@Help with the Image Wrapper component please](https://forums.unrealengine.com/t/help-with-the-image-wrapper-component-please/269276/7):
>
> I finally solved my problem. But I would like to know other solutions as well to get by this. So I’m not going to mark this as solved because there are other ways when it comes to dynamic texturing and materials, so it’s open for debate, come in, don’t be shy slight_smile frowning I used UMaterialInterface\* LoadedMaterial = LoadObject(nullptr, TEXT(“/Game/container\_Mat.container\_Mat”), nullptr, LOAD\_None, nullptr); I loaded the material without the constructor helper and made a parameter…

and this.

> [@How to apply a UTexture2D to a UStaticMeshComponent?](https://forums.unrealengine.com/t/how-to-apply-a-utexture2d-to-a-ustaticmeshcomponent/144369):
>
> So in my header I have: UPROPERTY(EditAnywhere) UStaticMeshComponent\* SampleMesh; And set the mesh with the dragged in instance: The in my cpp implementation I load a PNG into a UTexture2D successfully. TSharedPtr\<IImageWrapper\> PNGImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::PNG); /\* File load code skipped for this post \*/ if(PNGImageWrapper-\>GetRaw(ERGBFormat::BGRA, 8, RawData)) { UE\_LOG(LogTemp, Log, TEXT("GetRaw success keep going"));…

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-correctly-set-material-for-an-instanced-static-mesh/632477)._
