Material function if statement not working. If based on is Play value. Help

Hi I have small problem.

I have a material function occluding pixels from camera to my character locations but when the character doesn’t exist because the game didn’t start, it starts occluding to the middle of the scene. I wanted to make it work only while the game is in play mode so as you can see on the screens i made scalar parameter with default value 0, set it on begin play to 1, and i added “if” to that material function aaand the final resoult is white trees. I don’t understand why. I don’t have any errors to guide me. That material function should only affect opacity. Looks like material is just not working i guess? I’m just kind of lost what happend. Help :c



Looks like MPC breaks the material if its connected to if or lerp alpha node for some reason… Do you have any ideas how do i do it in some other way? How do i apply occlusion only while play mode is active?