# \[4.11\]\[UMG\] How to change parameters in a Material used in UMG

**URL:** <https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512>\
**Category:** UI\
**Tags:** unreal-engine, Widget, Blueprint, question, UMG\
**Created:** [February 5, 2016, 4:01pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512 "2016-02-05T16:01:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seirei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seirei](https://forums.unrealengine.com/u/Seirei)\
**Post date:** [February 5, 2016, 4:01pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/1 "2016-02-05T16:01:48Z")

</div>

Hi,

so I’m currently trying to use a Material for a circular mask in my UMG widget. This is working just fine, but I just can’t get it to change on runtime.

I tried using a parameter collection in the material that’s changed in the level blueprint. Again, it’s working nicely, but it won’t work for the Widget, since that needs a Interface Material and those can’t handle parameter collection inputs. [Apparently since 4.7](https://answers.unrealengine.com/questions/176031/47-p8umg-material-parameter-collections-break-mate.html)

Then I tried using a dynamic instance material, but I just can’t figure out how to pass my variables from the level to the actual material in the widget.

I’m also using a widget that’s placed inside a Blueprint to place the widget in my scene. I tried a canvas texture earlier, but that was even more of a hassle and involved a lot of trial and error, just to get stuck on the same problem.

So how exactly can I control the material referenced as an image inside my Widget?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9532c9a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9532c9a](https://forums.unrealengine.com/u/anonymous_user_b9532c9a)\
**Post date:** [February 8, 2016, 8:12pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/2 "2016-02-08T20:12:42Z")

</div>

Hi Seirei,

Have you tried utilizing a dynamic material instance to apply the changes directly to your material? Follow the steps here to set up a dynamic material instance, you should be able to make alterations as needed once you have this set up:

> **[Creating and Using Material Instances](https://docs.unrealengine.com/5.1/en-US/creating-and-using-material-instances-in-unreal-engine/)**
>
> Guide for setting up and using Material Instances.

---

<div class="post-metadata">

**Author:** ![Seirei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seirei](https://forums.unrealengine.com/u/Seirei)\
**Post date:** [February 9, 2016, 11:38am UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/3 "2016-02-09T11:38:53Z")

</div>

Yeah that’s what I’m using right now. I just wasn’t sure how to reference the instance and how to use it.

I got it working with this workflow:

- In the widget designer I create an image object and place it
- then I create a slate brush variable and use it in in the “bind” slot for the image itself
- in a function I use the create dynamit material instance
- promote that output to a variable so I can reference it later and use it in a “make SlateBrush” node
- the output of that node goes into a “set” of the slate brush variable I use for the image

Do you think this is an acceptable workflow?

Currently I’m also wondering how you would reference a widget inside your game mode if it is placed inside a blueprint in your level.

Using event dispatchers seemed like the way to go, but since you need a target I’m not sure how you would acces it from inside the game mode. Basically I’m trying to get an exec ‘pulse’ from the game mode into the widget.

Thanks for your time! 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9532c9a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9532c9a](https://forums.unrealengine.com/u/anonymous_user_b9532c9a)\
**Post date:** [February 9, 2016, 6:29pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/4 "2016-02-09T18:29:12Z")

</div>

I believe you would want to use “get all widgets of class” to get the specific widgets you are looking for and access the information from there.

---

<div class="post-metadata">

**Author:** ![Seirei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seirei](https://forums.unrealengine.com/u/Seirei)\
**Post date:** [February 12, 2016, 12:03pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/5 "2016-02-12T12:03:01Z")

</div>

Hi ,

so I’ve been playing around with this for a bit, but I’m not sure how to get it to work.

How exactly do you use the “get all widgets of class” node? The output would be an array and it won’t let me use that for a “cast to…” or the bind node of an event dispatcher.  
Using the “Get” from an array with the integer set to any number doesn’t work either. It won’t let me connect it to the event dispatcher binding and if I try to cast it it simply fails the cast.

All I want to do is to take one specific widget, no matter if it’s placed inside another blueprint or drawn as a hud, use it’s variables to controll stuff and be able to save them somewhere so I can restore them on my next startup. But the whole saving process is a completely different problem in itself.

Would it be possible for you to provide an example?

Like something very simple. A widget, drawn on the viewport with a slider in it that affects something in the level, like the rotation of a cube. And the ability to save it, so that on startup the cube has the same rotation and the slider is on the same position.

From there I just have to apply this to my example on a bigger scale, I hope.

Thanks anyways for the quick replys!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9532c9a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9532c9a](https://forums.unrealengine.com/u/anonymous_user_b9532c9a)\
**Post date:** [February 12, 2016, 6:38pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/6 "2016-02-12T18:38:59Z")

</div>

Hi Seirei,

I created a small sample to show what I mean. Please bear in mind this is an extremely limited and simplistic representation of the concepts behind Get all actors/widgets. Both work in the same way, the only difference being that one looks for blueprint actors and one looks for widgets. To get the save information, check out our save/load documentation here:

[https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html](https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html)

project

---

<div class="post-metadata">

**Author:** ![Seirei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seirei](https://forums.unrealengine.com/u/Seirei)\
**Post date:** [February 15, 2016, 9:31am UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/7 "2016-02-15T09:31:00Z")

</div>

Okay I’ve downloaded your scene and I think I get the idea now.

But for that I would need to completely redoo my blueprint workflow, because I currently use event dispatchers to send the values of my slider updates with their value into the level blueprint and use them on referenced actors in the level.

Your method seems way more modular, though, so thanks a lot! I’ll let you know if it worked.

I also took a look at the save/load documentation and I still have a tough time wrapping my head around it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9532c9a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9532c9a](https://forums.unrealengine.com/u/anonymous_user_b9532c9a)\
**Post date:** [February 15, 2016, 8:42pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/8 "2016-02-15T20:42:11Z")

</div>

Saving and loading can be extremely difficult to work through. We have a video tutorial that makes use of the Save Game Object, you can check it out here:

[https://www](https://www)…com/watch?v=2vcqKH4ILHY

---

<div class="post-metadata">

**Author:** ![Seirei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seirei](https://forums.unrealengine.com/u/Seirei)\
**Post date:** [February 16, 2016, 1:32pm UTC](https://forums.unrealengine.com/t/4-11-umg-how-to-change-parameters-in-a-material-used-in-umg/346512/9 "2016-02-16T13:32:29Z")

</div>

Hi ,

thanks for everything!

I finally got it to work and now I’m able to interact with objects using UMG. 🙂

16 Sliders with on and off checkbox, 32 Variables, in the Widget and 32 in the Save Blueprint makes 64 per row and one is for saving and one is the loading.

So I have a total of 128 nodes that get and set different variables.

 ![78732-blueprintoverview.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/7/4974375e51cc27335fb2e93d1497146902f15a0c.jpeg)

I feel there has to be a better way to exchange this data, but for the moment it works just fine and I’m happy that I finally know how to handle all of this.  
Using the “Cast to” nodes also took a bit of getting used to.

So once again, thanks for the great support! 🙂
