It doesn't work correctly.

function Update () {
	var timeNow = Time.timeSinceLevelLoad;
	switch( startflag )
	{
		case 0:
			if ( alpha==1 )	// 다 밝아졌으면 대기하기
			{
				startflag = 1;
				nowtime = timeNow;
			}
		break;
		case 1:	// 화면 대기
			fadeDir=0;

			if ( (timeNow - nowtime) > 3 ) // 다음으로 넘기기
			{
				alpha=1;
				fadeIn();
				startflag = 2;
			}
		break;
		case 2:
			if ( alpha==0 ) // 다음으로 넘기기
			{
				startflag = 3;
				alpha=0;		// 먼저 밝아지기
				fadeOut();
			}
		break;
		case 3:	// 화면 대기
			if ( alpha == 1 ) // 다음으로 넘기기
			{
				startflag = 4;
				nowtime = timeNow;
			}
		break;
		case 4:
			fadeDir=0;
			if ( (timeNow - nowtime) > 3 ) // 다음으로 넘기기
			{
				alpha=1;
				fadeIn();
				startflag = 5;
			}
		break;
		case 5:
			if ( alpha==0 )	// 다 밝아졌으면 대기하기
			{
				startflag = 6;
			}
		break;
		case 6:
		break;

	}
}

I maked function for ‘fade in and out’.

But just working this.
firsttexture : Out-Delay-In
secondtexture : Out-In

I don’t know why. Please help me. What’s problem this?

Can you post the code for the FadeIn and FadeOut functions?

Also, you might want to consider using coroutines for this task - it is often easier than using a state machine for tasks like this.

^^ OK

public var fadetexture : Texture2D;
public var fadeSpeed = 0.3;

//--------------------------------------------------------------------
//                       Private variables
//--------------------------------------------------------------------

private var alpha = 1.0; 

private var fadeDir = -1;

private var startflag = 0;

//--------------------------------------------------------------------
//                       Runtime functions
//--------------------------------------------------------------------

//--------------------------------------------------------------------

function OnGUI(){
   
    alpha += fadeDir * fadeSpeed * Time.deltaTime;  
    alpha = Mathf.Clamp01(alpha);   
    
    GUI.color.a = alpha;

	GUI.DrawTexture(Rect(0,0,1024,768), fadetexture );
}

//--------------------------------------------------------------------

function fadeIn(){
    fadeDir = -1;   
}
 
//--------------------------------------------------------------------

function fadeOut(){
    fadeDir = 1;    
} 

function Start(){
    alpha=0;		// 먼저 밝아지기
    fadeOut();
}

function Update () {
	var timeNow = Time.timeSinceLevelLoad;
	switch( startflag )
	{
		case 0:
			if ( alpha==1 )	// 다 밝아졌으면 대기하기
			{
				startflag = 1;
				nowtime = timeNow;
			}
		break;
		case 1:	// 화면 대기
			fadeDir=0;

			if ( (timeNow - nowtime) > 3 ) // 다음으로 넘기기
			{
				alpha=1;
				fadeIn();
				startflag = 2;
			}
		break;
		case 2:
			if ( alpha==0 ) // 다음으로 넘기기
			{
				Application.LoadLevel(Application.loadedLevel+1);
			}
		break;
	}
}

I cannot figur out this problem. So I just sereate two scene and used function ‘LoadLevel’. :stuck_out_tongue: