# Creating a material instance for each button all good?

**URL:** <https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [January 5, 2021, 3:13pm UTC](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815 "2021-01-05T15:13:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![indivelope](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/indivelope/32/974286_2.png) [@indivelope](https://forums.unrealengine.com/u/indivelope)\
**Post date:** [January 5, 2021, 3:13pm UTC](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815/1 "2021-01-05T15:13:08Z")

</div>

Hi, I have a squircle material which makes rounded boxes which I am currently using for a UMG button style.  
When I create a button it’s sized to the text inside it, so the material has to change some size settings to make the rounded box look normal. (Otherwise the rounded corners aren’t ‘round’ but more oblong). _ **So, for every button, I basically create a material instance** _ and set the parameters to match the button size. There is no textures in the material and I am using the ‘GeneratedRoundedRect’ node.

Is this standard procedure? Thanks for any insight 🙂

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 5, 2021, 6:42pm UTC](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815/2 "2021-01-05T18:42:55Z")

</div>

> (Otherwise the rounded corners aren’t  
> ‘round’ but more oblong).

Look into how [9-slice](https://en.wikipedia.org/wiki/9-slice_scaling) works (called 9 Scale Box in UE4) - `Setting Image States`, here:

> **[UMG Styling](https://docs.unrealengine.com/5.3/en-US/umg-styling-in-unreal-engine/)**
>
> A guide to stylizing Widget Blueprints in UMG.

The margins control how much of the edges are preserved.

* * *

If all you want is rounded boxes on differently shaped buttons, 1 material instance is enough for this.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 5, 2021, 6:49pm UTC](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815/3 "2021-01-05T18:49:09Z")

</div>

To demonstrate what I mean, notice how the bevelled element does not get distorted:

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/7/777743a687118312d2ec8658d4b0485379fefdd1.gif)](https://gyazo.com/d75f7cf0fbca80c75bc46c4629cf0058)

As 0.4 (40%) of the image (counting from the the right hand side) is preserved as a fixed border edge.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 5, 2021, 6:51pm UTC](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815/4 "2021-01-05T18:51:53Z")

</div>

The above is just an image, making the gradient look wonky, it will look fine with a material, though!

---

<div class="post-metadata">

**Author:** ![indivelope](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/indivelope/32/974286_2.png) [@indivelope](https://forums.unrealengine.com/u/indivelope)\
**Post date:** [January 6, 2021, 4:10am UTC](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815/5 "2021-01-06T04:10:47Z")

</div>

Thanks for that! 9-Slice. What a peculiar term.

Thanks again 🙂

EDIT: Well…All I did was make a circle and use it as a box with .5 margins and it’s a dynamic rounded box 😃 I do everything the hard way haha. I had a seriously messy node graph…

 ![326444-screenshot-2021-01-06-152935.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/b/0dbac3565afd97f3afca07827bd629adb7385d6c.png)

There is a yellow splotch in the screenshot but it’s only there if you don’t look at it. Weird.
