disable cast shadow through option

Hi, I made an android game, and it should run in most of the android devices. For low end devices I need to disable rendering shadows through option. So i made a blueprint and added directional light component as the root of blueprint.

After i made umg ui to disable shadows when button is pressed.I got reference to my directional light blueprint by get all actor class and set cast shadows to false as shown in the screenshot. when I play in editor it works as i expected .It stops casting shadows when i touch the button. But when i implement in real android device the shadows are not disabling. What I am doing wrong please help me how to fix it.

Mobile gets tricky, would it behave if you made the Directional Light Moveable instead of Stationary?

No if set to movable objects receive shadows but do not cast them due to limitations of mobile devices. I want shadows when playing on higher end device, but when playing on low end device I don’t want shadows to be rendered. So I made directional light stationary and made a blueprint and use node setcastshadow to disable casting shadows when an option in setting is turned on. It works well in editor while in real device it doesn’t stop casting shadows when the option is turned on.

I’ve had my share of problems getting the look of engine on mobile as well and I’m no expert here. There might be a mobile specific setting somewhere in the directional light but that’s merely a guess. Would it work having two directional lights that you toggle between? At least that way the settings are in place. Maybe that’ll trick the engine into doing what you want. But I think you need to look into mobile lighting more as it’s not so straightforward it seems.

Hello conardG, thanks for your response. I will look for mobile lightings. If I don’t find answers. I will give it try in another way. The another way is I will make two different materials for same model, one is lit and another is unlit. When I turn the option on(the option for meshes not to cast shadows), I will change to unlit materials at runtime again if I turn it off I will change it to lit. I don’t know if this work or not I will give it a try. Thanks.

Hello, my second approach didn’t succed. So is there any other way to disable/enable shadows at runtime please help me.