# How to set static switch parameter of Material Instance Constant

**URL:** <https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [January 13, 2021, 9:21am UTC](https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268 "2021-01-13T09:21:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anjeong](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anjeong](https://forums.unrealengine.com/u/Anjeong)\
**Post date:** [January 13, 2021, 9:21am UTC](https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268/1 "2021-01-13T09:21:49Z")

</div>

Hello all,

Happy New Year!

I have an issue to change switch parameter of material instance in asset view.  
I can do that if there are a few but I have over 1000 assets. (It is easy. just click check box!) so I tried to use python to do this automatically.

I googled a lot but I could get only setting scalar and vector not boolean and switch.  
I know that boolean and switch can not change value at runtime but I want to change it not runtime.

could you guys have any good solutions?

Thanks

---

<div class="post-metadata">

**Author:** ![brisket](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brisket/32/88707_2.png) [@brisket](https://forums.unrealengine.com/u/brisket)\
**Post date:** [January 13, 2021, 6:17pm UTC](https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268/2 "2021-01-13T18:17:51Z")

</div>

See [https://docs.unrealengine.com/en-US/…ngLibrary.html](https://docs.unrealengine.com/en-US/PythonAPI/class/MaterialEditingLibrary.html)  
~~There is a get\_material\_default\_static\_switch\_parameter\_value() method.~~  
Oops, that’s a get. Nevermind.

_Edit_:  
Based on this previous forum post, others have created different material instances variants with these static parameters turned on/of and then used the appropriate one. Yeah, I know not great if you have many switch parameters.

On another note: I found another guy implementing his own custom Blueprint function to set the switch parameter: [[UE4]Material Instance の Static Switch Parameter を 変更する関数・ノードを作る方法について - Qiita](https://qiita.com/EGJ-Kaz_Okada/items/4fd6db895b398893cbbb)  
Warning, page is in Japanese. Unfortunately, I don’t think this can be converted to python.

---

<div class="post-metadata">

**Author:** ![swarmagent](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@swarmagent](https://forums.unrealengine.com/u/swarmagent)\
**Post date:** [December 7, 2021, 11:12pm UTC](https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268/3 "2021-12-07T23:12:04Z")

</div>

Thank you brisket for sharing the link. This is exactly what I have been searching for a while.  
Okada’s code works only if the override is manually checked.  
I have SwitchParameter.bOverride = true, but like Okada said, Instance-\>GetStaticParameters(); only contains parameters that have Override enabled.  
Does anyone know how to set both? Thank you.

---

<div class="post-metadata">

**Author:** ![john\_patterfonic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@john\_patterfonic](https://forums.unrealengine.com/u/john_patterfonic)\
**Post date:** [April 25, 2022, 11:32pm UTC](https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268/4 "2022-04-25T23:32:51Z")

</div>

I have the same question - how to enable the override checkbox using Python?

---

<div class="post-metadata">

**Author:** ![TON14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TON14](https://forums.unrealengine.com/u/TON14)\
**Post date:** [November 1, 2022, 8:33am UTC](https://forums.unrealengine.com/t/how-to-set-static-switch-parameter-of-material-instance-constant/156268/5 "2022-11-01T08:33:52Z")

</div>

save asset after setting parameters  
unreal.EditorAssetLibrary.save\_asset(‘/Game/Materials/Instance/MyNewCreatedMI’)
