Hello, can somebody please tell me why it gets stuck un the first value. so i have this custom shader and i want it to fade out (which is basicly changing the opacity of the rim color which is named: “_Scale”) but it works kind of strange… so instead of fading out it does nothing but shows me one value and no animation whatsoever. However if I change the speed its becomes more transparent when I press play (NO ANIMATION JUST MORE TRANSPARENT) and just stays there. No idea why this is happeneing.
Code:
Renderer rend;
// Use this for initialization
void Start () {
rend = GetComponent<Renderer>();
rend.material.shader = Shader.Find ("FresnelPack/Transparent Rim Unlit");
rend.material.SetFloat ("_Scale", Mathf.Lerp (0.8f, 0f, Time.deltaTime * 40));
}
Because that’s not the issue; MoveTowards is still a basic math function that returns a value immediately and doesn’t animate over time. You need to call it repeatedly for it to work.