- Home /
Change Transparency of a Cut-out Material
So I made a simple rectangle as a .png and imported it into unity. I placed it on a plane with the transparency-cut-out-specular material. I want the rectangle to fade out via opacity. I've been searching all around but I can't find a straight forward answer. The current script is:
var colorStart : Color = Color.red;
var colorEnd : Color = Color.green;
var duration : float = 1.0;
function Update () {
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
renderer.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}
I tried using: var colorEnd : Color = Color.clear; but that didn't work. Can you please help me. ][1]
Answer by Eric5h5 · Jul 21, 2013 at 03:54 AM
The whole point of a cutout shader is that the pixels are either 100% opaque or 100% transparent; that's why it's called "cutout". There's nothing in-between. Use a non-cutout transparent shader if you want different levels of transparency.
Thanks! I probably shouldv'e known. That also fixed my 'jagged' edges problem.
Answer by Lemo76 · Jul 21, 2013 at 07:41 AM
Sorry, I now changed it to transparent-Diffuse. So how do I do the material crossfading?
Your answer
Follow this Question
Related Questions
Why when I hit play the game is paused? 1 Answer
An object (A duck) keeps falling straight through the floor (solved) 1 Answer
Faux Gravity Jumping 1 Answer
Unity reboots my computer 1 Answer