- Home /
Question by
Medusa-Zenovka · May 26, 2015 at 03:35 PM ·
c#unity 5alphafade
Fading Objects does not work (Unity 5)
Hello,
Im trying to fade in an GameObject. I read several methods, but none works as intended. There is no transition between invisible and fully visible. Im using the Unity 5 Standard shader specular setup (Renderer mode is set to "Fade"), which works best so far. There is no performance issue here.
alpha += alphaStep * Time.deltaTime;
currentC = Color.Lerp(fadeInStart, fadeInEnd, alpha);
Renderer[] r = GetComponentsInChildren<Renderer>();
foreach(Renderer skin in r){
skin.material.SetColor("_Color", currentC);
}
EDIT One thing I have to mention: The mesh starts with Cutout Rendering Mode and changes to Fade via Script and back later.
Comment
I fixed it myself by creating a new dummy material with Fade Render $$anonymous$$ode that get temporarly assigned to the mesh. The script for changing the Rendering $$anonymous$$ode has been removed.