How to set static switch parameter of Material Instance Constant

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?


There is a get_material_default_static_switch_parameter_value() method.
Oops, that’s a get. Nevermind.

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
Warning, page is in Japanese. Unfortunately, I don’t think this can be converted to python.

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.

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

1 Like

save asset after setting parameters