I want to set alpha clipping in my material through script (URP), but
material.SetInt( "_AlphaClipping" , 1 );
doesnt work!
I want to set alpha clipping in my material through script (URP), but
material.SetInt( "_AlphaClipping" , 1 );
doesnt work!
It is a bit strange but you set the bool
to enable Alpha Clipping with a float
…
material.SetFloat("_AlphaClip", 1);
material.SetFloat("_Cutoff", 0.5f);
material.EnableKeyword("_ALPHATEST_ON");
I doubt this will help @Damalas anymore as it’s been 9 months. I hope it helps somebody
Also, you need to add EnableKeyword("_ALPHATEST_ON")
.
It did help, thank you for this. Also @Scarrow yes, you have to use it in order:
material.EnableKeyword("_ALPHATEST_ON");
material.SetFloat("_AlphaClip", 0);
When you want to set Alpha Clipping back to false, you need to:
material.DisableKeyword("_ALPHATEST_ON");
© 2022 - 2025 — McMap. All rights reserved.
Hey. This doesn't seem to work for me? Do I have to call the material.EnableKeyword("_ALPHATEST_ON"); before setting the float?
– Scarrow