Unity 3D Game Engine – Fade Out Transparency

1. MAIN TOP MENU> Gameobject> Create Other> Cube

2. Hierarchy, select the Cube> Inspector> materal slot, select Shader: Transparent/Diffuse

NOTICE; YOu HAVE TO USE a Transparent shader, in Unity3D only Transparent Shaders support alpha channel

3. Select the Cube and assign FadeOutTransparency.JS:


#pragma strict

	// Fades from minimum to maximum in seconds
	var minimum = 1.0;
	var maximum = 0.0;
	var fadeoutSpeed = 1f; // 0.1 slow, 2 fast

	function Start () {
	}

	function Update () {	
		gameObject.renderer.material.color.a = Mathf.Lerp (minimum, maximum, fadeoutSpeed * Time.time);
	}