# Dynamic Material Instance Can Be Set From The Mesh But Not The Reference?

**URL:** <https://forums.unrealengine.com/t/dynamic-material-instance-can-be-set-from-the-mesh-but-not-the-reference/663175>\
**Category:** Rendering\
**Tags:** unreal-engine, UE5-0, Rendering, Shaders, question\
**Created:** [October 5, 2022, 8:48pm UTC](https://forums.unrealengine.com/t/dynamic-material-instance-can-be-set-from-the-mesh-but-not-the-reference/663175 "2022-10-05T20:48:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![J0hn-C0nn0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@J0hn-C0nn0r](https://forums.unrealengine.com/u/J0hn-C0nn0r)\
**Post date:** [October 5, 2022, 8:48pm UTC](https://forums.unrealengine.com/t/dynamic-material-instance-can-be-set-from-the-mesh-but-not-the-reference/663175/1 "2022-10-05T20:48:29Z")

</div>

What I’m Tring To Do: After replacing a mesh I create a Dynamic Material Instance for it and save a reference too it to a variable. I set a bool to true which triggers an FInterpTo to set the Scalar Parameter Value using this reference.

Problem: The Issue is that when I do this I can get that same scalar value and print out both and it shows the value is changing but nothing happens.

So, I tried to change the Color. I did this immediately after creating the Dynamic Material Instance and nothing happened either.

In the Image below you’ll see two nodes. The one with an X is the one that doesn’t work. However, if I get the Dynamic Material from the Mesh itself then it works.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/c/fbcc77696e6a47e83c88b8c00c1e7c63df9bd17f.png)

Here is the Function I call on the Tick Event that interpolates the value:  
[Dynamic Material FInterpTo posted by Depredor | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/ci41ghqj/)

Here is the Function where I set the mesh and create the dynamic material instance as well as setting the reference:  
[Spawn Marker Function posted by Depredor | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/xmb51_kh/)

Any help would be appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [October 5, 2022, 9:27pm UTC](https://forums.unrealengine.com/t/dynamic-material-instance-can-be-set-from-the-mesh-but-not-the-reference/663175/2 "2022-10-05T21:27:56Z")

</div>

Spawn marker is called before set marker transition I assume.

Have you stepped through spawn marker (F9) and confirmed that:

- the static mesh you are retrieving is valid
- get material at slot 0 is valid and contains the parameter timeline
- Target SM DMI is valid during the function

---

<div class="post-metadata">

**Author:** ![J0hn-C0nn0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@J0hn-C0nn0r](https://forums.unrealengine.com/u/J0hn-C0nn0r)\
**Post date:** [October 5, 2022, 10:16pm UTC](https://forums.unrealengine.com/t/dynamic-material-instance-can-be-set-from-the-mesh-but-not-the-reference/663175/3 "2022-10-05T22:16:50Z")

</div>

Yeah, thanks for the response, man. I actually ended up finding out that creating a dynamic material instance isn’t enough, you have to assign that to your mesh as well. For some reason that just never crossed my mind.
