Saturday, 4 April 2015

Unity3D Tutorial Fade Out Camera

Unity3D Tutorial Fade Out Camera


Easter video series !









THIS IS Java# script: GOOD 4 2D GAMES AND 3D GAMES !
----------------------------------------­­­­­­­----------------------------------­-­-­-­-­-­-­------

DIRECT DOWNLOAD HERE




THIS IS BACKUP  IN TEXT FORM  TUTORIAL FadeOutCamera

1. Create New java and name it : FadeOutCamera


2. Copy & Past this text and save java :
----------------------------------------­­­­­------------------------------------­-­-­-­-­-



var fadeTime : float = 5;
var fadeTexture : Texture;
private var fadeOut : boolean = false;
private var tempTime : float;
private var time : float = 0.0;
var fadeOutSound : AudioClip;

function Start(){
fadeOut = true;
audio.clip = fadeOutSound;
audio.Play();
}


function Update(){
if (fadeOut){
if(time < fadeTime) time += Time.deltaTime;
tempTime = Mathf.InverseLerp(0.0, fadeTime, time);
}

if(tempTime >= 1.0) enabled = false;
}

function OnGUI(){
if(fadeOut){
GUI.color.a = 1 - tempTime;
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeTexture);
}
}







 ----------------------------------------­­­­­------------------------------------­-­-­-­-­-



0 comments:

Post a Comment