How to access a material instance variable from a blueprint object in Unreal Engine?

I have a texture material that changes between 2 textures. This change can be controller by a variable. I’ve made a material instance from this material as well as a blueprint that has an object in it, to which this MI texture is applied to. I was hoping to update the materials variable parameters through the blueprints event tick but I am having difficulties figuring out how to access this parameter.

Would anyone know what has to be done in blueprint to access parameters and change them?

It’s this for texture:

There’s also scalar and vector.

1 Like

So this is the parameter I am trying to change in the blueprints. But I seem to be struggling.

And I tried to follow your images of how to do the blueprint script but I’m not even getting permissions to

Do you know what else could be there? What one piece am I missing? I’m completely new to UE4 as well.

It looks like “Character material” isn’t a dynamic material instance. As far as I know you can only set parameter values from those. So if you dragged off the return value pin from the “Create Dynamic Material Instance Node” you would then be able to see the set/get parameter values.
Also if you were wanting to change the contrast parameter you would want to use Set Scalar Parameter Value.

Hope this helps

There’s a lot happening in there that does not seem right:

  • don’t forget to choose an actual material from the dropdown to make an instance out of
  • you can create references easily like so:

Image from Gyazo

  • you will need to also assign this material to something (top bit):

  • and it can be controlled like so (bottom bit)
2 Likes

It’s literally this, I believe you’re overthinking things.

4 Likes

Thanks. I didn’t know I can just straight promote it on the right side of the box. I think I was meant to say material? I have a material that has 2 textures in it, and a variable that controls the constrast between them.

And once I have my parameter name the same as the parameter’s name is in the material, how would I then take and alter this parameter inside the blueprint? Is there a way to call it? Or do I have to promote the parameter to a variable and then call that?

Hi! Sorry to bother you, but is there a way to do it for material instance and if so how?

Do what exactly to the material instance?

It’s hard to explain around here, I wanted to send pictures. can you tell me your email?

No, but you can send pictures here.

says that new users cant send images. do you know other way to talk to you?

Describe what’s needed. I think you can attach a single image per post initially.

I want that in the blueprint that on click change the Texture_Mask to the one I define.

Hello,
If I understand this right, you are looking for material parameter collection.
Take a look at the documentation Material Parameter Collections | Unreal Engine Documentation
Basically via this you can change the mask texture of the material, individually.

thanks, but it’s not like that. I want that when clicking on a widget button of a blueprint it will change that Texture_Mask to another one and not desaturate it

Yeah that was just a demonstration of how it can be used. But now I am not sure, you want to change the mesh or the material instance?

sorry my mistake, I meant Texture_Mask (The one that appears in the image I sent above). But thank you very much for the help, but i already managed to solve my problem!

1 Like