Hi, I am currently working on a project using Unity 2020.2.1f1 and URP. I have a shadergraph node setup that applies a dithering transparency effect to an opaque object using alpha clipping and I am lerping the opacity of the shader using a C# script.
The game object smoothly fades from opaque to invisible in the editor (Vulkan), but when running an android build (also Vulkan), the gameobject simply just immediately becomes completely invisible as soon as the fading is supposed to start.
Here is the C# coroutine that handles the fading:
float objectOpacity = 1f;
IEnumerator LerpOpacity(float targetValue, float durationSeconds)
{
if (objectOpacity != targetValue)
{
isFaded = true;
float time = 0f;
float startValue = objectOpacity;
while (time < durationSeconds)
{
//Pause color lerping while flashing is occurring.
while (isColorFlashing)
{
yield return null;
}
objectOpacity = Mathf.Lerp(startValue, targetValue, time / durationSeconds);
meshRenderer.material.SetFloat("Opacity", objectOpacity);
time += Time.deltaTime;
yield return null;
}
objectOpacity = targetValue;
meshRenderer.material.SetFloat("Opacity", targetValue);
}
}
Anyone have any insight as to what could be causing this?